FizzBuzzTest.java 1.6KB

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. @Test
  17. public void FizzBuzzTest()
  18. {
  19. int number = 15;
  20. String expected = "FizzBuzz";
  21. //where you cll the method
  22. String actual = FizzBuzz.FizzBuzzGame(number);
  23. assertEquals(expected, actual);
  24. }
  25. @Test
  26. public void FizzBuzzTest2()
  27. {
  28. int number = 6;
  29. String expected = "Fizz";
  30. //where you cll the method
  31. String actual = FizzBuzz.FizzBuzzGame(number);
  32. assertEquals(expected, actual);
  33. }
  34. @Test
  35. public void FizzBuzzTest3()
  36. {
  37. int number = 5;
  38. String expected = "Buzz";
  39. //where you cll the method
  40. String actual = FizzBuzz.FizzBuzzGame(number);
  41. assertEquals(expected, actual);
  42. }
  43. @Test
  44. public void FizzBuzzTest4()
  45. {
  46. int number = 0;
  47. String expected = "";
  48. //where you cll the method
  49. String actual = FizzBuzz.FizzBuzzGame(number);
  50. assertEquals(expected, actual);
  51. }
  52. /**
  53. * Sets up the test fixture.
  54. *
  55. * Called before every test case method.
  56. */
  57. @Before
  58. public void setUp()
  59. {
  60. }
  61. /**
  62. * Tears down the test fixture.
  63. *
  64. * Called after every test case method.
  65. */
  66. @After
  67. public void tearDown()
  68. {
  69. }
  70. }