123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. /**
  6. * The test class FizzBuzzTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class FizzBuzzTest
  12. {
  13. /**
  14. * Default constructor for test class FizzBuzzTest
  15. */
  16. public FizzBuzzTest()
  17. {
  18. }
  19. /**
  20. * Sets up the test fixture.
  21. *
  22. * Called before every test case method.
  23. */
  24. @Before
  25. public void setUp()
  26. {
  27. }
  28. @Test
  29. public void FizzTest() {
  30. String expected = "Fizz";
  31. FizzBuzz fb = new FizzBuzz();
  32. String actual = fb.of(3);
  33. assertEquals(expected, actual);
  34. }
  35. @Test
  36. public void BuzzTest() {
  37. String expected = "Buzz";
  38. FizzBuzz fb = new FizzBuzz();
  39. String actual = fb.of(5);
  40. assertEquals(expected, actual);
  41. }
  42. @Test
  43. public void FizzAndBuzzTest() {
  44. String expected = "FizzBuzz";
  45. FizzBuzz fb = new FizzBuzz();
  46. String actual = fb.of(15);
  47. assertEquals(expected, actual);
  48. }
  49. @Test
  50. public void ElseTest() {
  51. String expected = "2";
  52. FizzBuzz fb = new FizzBuzz();
  53. String actual = fb.of(2);
  54. assertEquals(expected, actual);
  55. }
  56. /**
  57. * Tears down the test fixture.
  58. *
  59. * Called after every test case method.
  60. */
  61. @After
  62. public void tearDown()
  63. {
  64. }
  65. }