123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
-
-
- 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
- {
- /**
- * Default constructor for test class FizzBuzzTest
- */
- public FizzBuzzTest()
- {
- }
- private FizzBuzz fizzBuzz;
- /**
- * Sets up the test fixture.
- *
- * Called before every test case method.
- */
- @Before
- public void setup() {
- fizzBuzz = new FizzBuzz();
- }
-
- @Test
- public void fizzTest1() {
- //given
- String expected = "Fizz";
- //when
- String actual = fizzBuzz.result(3);
- //then
- assertEquals(expected, actual);
- }
-
- @Test
- public void fizzTest2() {
- //given
- String expected = "Fizz";
- //when
- String actual = fizzBuzz.result(9);
- //then
- assertEquals(expected, actual);
- }
-
- @Test
- public void buzzTest1() {
- //given
- String expected = "Buzz";
- //when
- String actual = fizzBuzz.result(5);
- //then
- assertEquals(expected, actual);
- }
-
- @Test
- public void buzzTest2() {
- //given
- String expected = "Buzz";
- //when
- String actual = fizzBuzz.result(20);
- //then
- assertEquals(expected, actual);
- }
-
- @Test
- public void fizzBuzzTest1() {
- //given
- String expected = "FizzBuzz";
- //when
- String actual = fizzBuzz.result(15);
- //then
- assertEquals(expected, actual);
- }
-
- @Test
- public void fizzBuzzTest2() {
- //given
- String expected = "FizzBuzz";
- //when
- String actual = fizzBuzz.result(30);
- //then
- assertEquals(expected, actual);
- }
-
- @Test
- public void numberTest() {
- //given
- String expected = "11";
- //when
- String actual = fizzBuzz.result(11);
- //then
- assertEquals(expected, actual);
- }
- }
|