123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class FizzBuzzTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class FizzBuzzTest
- {
- FizzBuzz test = new FizzBuzz();
-
- /**
- * Default constructor for test class FizzBuzzTest
- */
- public FizzBuzzTest()
- {
- }
- @Test
- public void fizzbuzzTest1(){
- //Give
- int x = 2;
-
-
- //When
- String actual = test.fizzbuzz(x);
- String expected = "2";
-
- //Result
- assertEquals(actual,expected);
- }
-
- @Test
- public void fizzbuzzTest2(){
- //Give
- int x = 3;
-
-
- //When
- String actual = test.fizzbuzz(x);
- String expected = "Fizz";
-
- //Result
- assertEquals(actual,expected);
- }
- @Test
- public void fizzbuzzTest3(){
- //Give
- int x = 5;
-
-
- //When
- String actual = test.fizzbuzz(x);
- String expected = "Buzz";
-
- //Result
- assertEquals(actual,expected);
- }
-
- /**
- * Sets up the test fixture.
- *
- * Called before every test case method.
- */
- @Before
- public void setUp()
- {
- }
- @Test
- public void fizzbuzzTest4(){
- //Give
- int x = 15;
-
-
- //When
- String actual = test.fizzbuzz(x);
- String expected = "FizzBuzz";
-
- //Result
- assertEquals(actual,expected);
-
- }
-
- /**
- * Tears down the test fixture.
- *
- * Called after every test case method.
- */
- @After
- public void tearDown()
- {
- }
-
-
- }
|