123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class FizzBuzzMainTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class FizzBuzzMainTest
- {
- FizzBuzzMain fizzBuzzMain = new FizzBuzzMain();
-
- @Test
- public void testNonMultiples()
- {
- assertEquals("2", fizzBuzzMain.main(1));
- assertEquals("2", fizzBuzzMain.main(2));
- assertEquals("2", fizzBuzzMain.main(4));
- assertEquals("2", fizzBuzzMain.main(7));
- assertEquals("2", fizzBuzzMain.main(8));
- assertEquals("2", fizzBuzzMain.main(11));
- }
-
- @Test
- public void testMultiplesOf3()
- {
- assertEquals("Fizz", fizzBuzzMain.main(3));
- assertEquals("Fizz", fizzBuzzMain.main(6));
- assertEquals("Fizz", fizzBuzzMain.main(9));
- assertEquals("Fizz", fizzBuzzMain.main(12));
- assertEquals("Fizz", fizzBuzzMain.main(18));
- assertEquals("Fizz", fizzBuzzMain.main(21));
- }
-
- @Test
- public void testMultiplesOf5()
- {
- assertEquals("Buzz", fizzBuzzMain.main(5));
- assertEquals("Buzz", fizzBuzzMain.main(10));
- assertEquals("Buzz", fizzBuzzMain.main(20));
- assertEquals("Buzz", fizzBuzzMain.main(25));
- assertEquals("Buzz", fizzBuzzMain.main(35));
- assertEquals("Buzz", fizzBuzzMain.main(40));
- }
-
- @Test
- public void testMultiplesOf3And5()
- {
- assertEquals("FizzBuzz", fizzBuzzMain.main(15));
- assertEquals("FizzBuzz", fizzBuzzMain.main(30));
- assertEquals("FizzBuzz", fizzBuzzMain.main(45));
- assertEquals("FizzBuzz", fizzBuzzMain.main(60));
- assertEquals("FizzBuzz", fizzBuzzMain.main(75));
- assertEquals("FizzBuzz", fizzBuzzMain.main(90));
- }
- }
|