FizzBuzzTest.java 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import 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. FizzBuzz fb;
  14. @Before
  15. public void setup() {
  16. fb = new FizzBuzz();
  17. }
  18. @Test
  19. public void fizzBuzzTest1() {
  20. String expected = "1";
  21. String actual = fb.of(1);
  22. Assert.assertEquals(expected, actual);
  23. }
  24. @Test
  25. public void fizzBuzzTest3() {
  26. String expected = "fizz";
  27. String actual = fb.of(3);
  28. Assert.assertEquals(expected, actual);
  29. }
  30. @Test
  31. public void fizzBuzzTest9() {
  32. String expected = "fizz";
  33. String actual = fb.of(9);
  34. Assert.assertEquals(expected, actual);
  35. }
  36. @Test
  37. public void fizzBuzzTest5() {
  38. String expected = "buzz";
  39. String actual = fb.of(5);
  40. Assert.assertEquals(expected, actual);
  41. }
  42. @Test
  43. public void fizzBuzzTest10() {
  44. String expected = "buzz";
  45. String actual = fb.of(10);
  46. Assert.assertEquals(expected, actual);
  47. }
  48. @Test
  49. public void fizzBuzzTest15() {
  50. String expected = "fizzbuzz";
  51. String actual = fb.of(15);
  52. Assert.assertEquals(expected, actual);
  53. }
  54. }