|
@@ -1,2 +1,75 @@
|
|
1
|
+import org.junit.Assert;
|
|
2
|
+import org.junit.Test;
|
|
3
|
+
|
1
|
4
|
public class FizzBuzzTest {
|
|
5
|
+
|
|
6
|
+ @Test
|
|
7
|
+ public void fizz(){
|
|
8
|
+ // Given
|
|
9
|
+ FizzBuzz fizzbuzz = new FizzBuzz();
|
|
10
|
+ int x = 9;
|
|
11
|
+ String expected = "Fizz";
|
|
12
|
+
|
|
13
|
+ // When
|
|
14
|
+ String actual = fizzbuzz.divide(x);
|
|
15
|
+
|
|
16
|
+ // Then
|
|
17
|
+ Assert.assertEquals(expected, actual);
|
|
18
|
+ }
|
|
19
|
+
|
|
20
|
+ @Test
|
|
21
|
+ public void buzz(){
|
|
22
|
+ // Given
|
|
23
|
+ FizzBuzz fizzbuzz = new FizzBuzz();
|
|
24
|
+ int x = 10;
|
|
25
|
+ String expected = "Buzz";
|
|
26
|
+
|
|
27
|
+ // When
|
|
28
|
+ String actual = fizzbuzz.divide(x);
|
|
29
|
+
|
|
30
|
+ // Then
|
|
31
|
+ Assert.assertEquals(expected, actual);
|
|
32
|
+ }
|
|
33
|
+
|
|
34
|
+ @Test
|
|
35
|
+ public void fizzAndBuzz(){
|
|
36
|
+ // Given
|
|
37
|
+ FizzBuzz fizzbuzz = new FizzBuzz();
|
|
38
|
+ int x = 15;
|
|
39
|
+ String expected = "FizzBuzz";
|
|
40
|
+
|
|
41
|
+ // When
|
|
42
|
+ String actual = fizzbuzz.divide(x);
|
|
43
|
+
|
|
44
|
+ // Then
|
|
45
|
+ Assert.assertEquals(expected, actual);
|
|
46
|
+ }
|
|
47
|
+
|
|
48
|
+ @Test
|
|
49
|
+ public void numberNotFizzBuzz(){
|
|
50
|
+ // Given
|
|
51
|
+ FizzBuzz fizzbuzz = new FizzBuzz();
|
|
52
|
+ int x = 16;
|
|
53
|
+ String expected = "16";
|
|
54
|
+
|
|
55
|
+ // When
|
|
56
|
+ String actual = fizzbuzz.divide(x);
|
|
57
|
+
|
|
58
|
+ // Then
|
|
59
|
+ Assert.assertEquals(expected, actual);
|
|
60
|
+ }
|
|
61
|
+
|
|
62
|
+ @Test
|
|
63
|
+ public void numberNotFizzBuzz2(){
|
|
64
|
+ // Given
|
|
65
|
+ FizzBuzz fizzbuzz = new FizzBuzz();
|
|
66
|
+ int x = 2;
|
|
67
|
+ String expected = "2";
|
|
68
|
+
|
|
69
|
+ // When
|
|
70
|
+ String actual = fizzbuzz.divide(x);
|
|
71
|
+
|
|
72
|
+ // Then
|
|
73
|
+ Assert.assertEquals(expected, actual);
|
|
74
|
+ }
|
2
|
75
|
}
|