FizzBuzzConverterTest.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 FizzBuzzConverterTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class FizzBuzzConverterTest
  12. {
  13. FizzBuzzConverter fizzBu = new FizzBuzzConverter();
  14. @Test
  15. public void fizzBuzzConverterLeavesNormalNumbers(){
  16. int x =2;
  17. String actual =this.fizzBu.fizzBuzz(x);
  18. String expected = "2";
  19. assertEquals(expected,actual);
  20. }
  21. @Test
  22. public void fizzBuzzConvertorMultiplesOfThree(){
  23. int x = 3;
  24. String actual = this.fizzBu.fizzBuzz(x);
  25. String expected = "Fizz";
  26. assertEquals(expected,actual);
  27. }
  28. @Test
  29. public void fizzBuzzConvertorMultiplesOfFive(){
  30. int x=5;
  31. String actual = fizzBu.fizzBuzz(x);
  32. String expected = "Buzz";
  33. assertEquals(expected, actual);
  34. }
  35. @Test
  36. public void fizzBuzzConvertorMultiplesOfFifthTeen(){
  37. int x = 15;
  38. String actual = this.fizzBu.fizzBuzz(x);
  39. String expected = "Fizz Buzz";
  40. assertEquals(expected, actual);
  41. }
  42. }