|
@@ -1,2 +1,55 @@
|
|
1
|
+import org.junit.Assert;
|
|
2
|
+import org.junit.Test;
|
|
3
|
+
|
1
|
4
|
public class FizzBuzzTest {
|
|
5
|
+ // We expect FizzBuzz.of(3) to return "Fizz"
|
|
6
|
+ // We expect FizzBuzz.of(5) to return "Buzz"
|
|
7
|
+ // We expect FizzBuzz.of(15) to return "FizzBuzz"
|
|
8
|
+ // Anything else will return the number FizzBuzz.of(2) returns "2"
|
|
9
|
+
|
|
10
|
+ @Test
|
|
11
|
+ public void fizzTest() {
|
|
12
|
+ // Given
|
|
13
|
+ // FizzBuzz fizz = new FizzBuzz();
|
|
14
|
+ int n = 6;
|
|
15
|
+ String expected = "Fizz";
|
|
16
|
+
|
|
17
|
+ //When
|
|
18
|
+ String actual = FizzBuzz.of(n);
|
|
19
|
+
|
|
20
|
+ Assert.assertEquals(expected, actual);
|
|
21
|
+ }
|
|
22
|
+
|
|
23
|
+ @Test
|
|
24
|
+ public void buzzTest() {
|
|
25
|
+ // Given
|
|
26
|
+ int n = 25;
|
|
27
|
+ String expected = "Buzz";
|
|
28
|
+
|
|
29
|
+ // When
|
|
30
|
+ String actual = FizzBuzz.of(n);
|
|
31
|
+ Assert.assertEquals(expected, actual);
|
|
32
|
+ }
|
|
33
|
+
|
|
34
|
+ @Test
|
|
35
|
+ public void fizzBuzzTest() {
|
|
36
|
+ // Given
|
|
37
|
+ int n = 60;
|
|
38
|
+ String expected = "FizzBuzz";
|
|
39
|
+
|
|
40
|
+ // When
|
|
41
|
+ String actual = FizzBuzz.of(n);
|
|
42
|
+ Assert.assertEquals(expected, actual);
|
|
43
|
+ }
|
|
44
|
+
|
|
45
|
+ @Test
|
|
46
|
+ public void otherFizzBuzzTest() {
|
|
47
|
+ //Given
|
|
48
|
+ int n = 26;
|
|
49
|
+ String expected = "2";
|
|
50
|
+
|
|
51
|
+ // When
|
|
52
|
+ String actual = FizzBuzz.of(n);
|
|
53
|
+ Assert.assertEquals(expected, actual);
|
|
54
|
+ }
|
2
|
55
|
}
|