-
Notifications
You must be signed in to change notification settings - Fork 0
/
FizzBuzzTest.java
39 lines (31 loc) · 1.02 KB
/
FizzBuzzTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import static org.junit.Assert.*;
import org.junit.Test;
public class FizzBuzzTest {
@Test
public void testShouldReturnNumberWhenGiveANonMultipleOf3Or5() {
assertEquals("1", FizzBuzz.returnAnwser(1));
assertEquals("2", FizzBuzz.returnAnwser(2));
}
@Test
public void testShouldReturnFizzWhenGiveAMultipleOf3() {
assertEquals("Fizz", FizzBuzz.returnAnwser(3));
assertEquals("Fizz", FizzBuzz.returnAnwser(6));
}
@Test
public void testShouldReturnBuzzWhenGiveAMultipleOf5() {
assertEquals("Buzz", FizzBuzz.returnAnwser(5));
assertEquals("Buzz", FizzBuzz.returnAnwser(10));
}
@Test
public void testShouldReturnFizzBuzzWhenGiveAMultipleOf3And5() {
assertEquals("FizzBuzz", FizzBuzz.returnAnwser(15));
assertEquals("FizzBuzz", FizzBuzz.returnAnwser(30));
}
@Test(expected=IndexOutOfBoundsException.class)
public void testShouldThrowIndexOutOfBoundsExceptionWhenGiveOutOfRangeNumber() {
FizzBuzz.returnAnwser(102);
FizzBuzz.returnAnwser(101);
FizzBuzz.returnAnwser(-1);
FizzBuzz.returnAnwser(0);
}
}