FizzBuzzTest.java 743B

123456789101112131415161718192021222324252627282930313233
  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 FizzBuzz.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class FizzBuzzTest
  12. {
  13. FizzBuzz fizzBuzz = new FizzBuzz();
  14. @Test
  15. public void testThreeToFifty()
  16. {
  17. String expected = "1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz "
  18. + "11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz "+
  19. "26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 "
  20. +"44 FizzBuzz 46 47 Fizz 49 Buzz ";
  21. String actual = fizzBuzz.printFizzBuzz(50);
  22. assertEquals(expected, actual);
  23. }
  24. }