|
@@ -1,2 +1,147 @@
|
|
1
|
+import org.junit.Assert;
|
|
2
|
+import org.junit.Test;
|
|
3
|
+
|
1
|
4
|
public class FizzBuzzTest {
|
|
5
|
+
|
|
6
|
+ @Test
|
|
7
|
+ public void testThree(){
|
|
8
|
+ //Given: Setup
|
|
9
|
+ int number=3;
|
|
10
|
+ String expectedOutput= "Fizz";
|
|
11
|
+
|
|
12
|
+ //when (invoke the method under test)
|
|
13
|
+ String actualOutput=FizzBuzz.divisibleByThree(number);
|
|
14
|
+
|
|
15
|
+ //Then
|
|
16
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
17
|
+ }
|
|
18
|
+
|
|
19
|
+ @Test
|
|
20
|
+ public void testThree4(){
|
|
21
|
+ //Given: Setup
|
|
22
|
+ int number=4;
|
|
23
|
+ String expectedOutput= "4";
|
|
24
|
+
|
|
25
|
+ //when (invoke the method under test)
|
|
26
|
+ String actualOutput=FizzBuzz.divisibleByThree(number);
|
|
27
|
+
|
|
28
|
+ //Then
|
|
29
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ @Test
|
|
33
|
+ public void testThree6(){
|
|
34
|
+ //Given: Setup
|
|
35
|
+ int number=6;
|
|
36
|
+ String expectedOutput= "Fizz";
|
|
37
|
+
|
|
38
|
+ //when (invoke the method under test)
|
|
39
|
+ String actualOutput=FizzBuzz.divisibleByThree(number);
|
|
40
|
+
|
|
41
|
+ //Then
|
|
42
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
43
|
+ }
|
|
44
|
+
|
|
45
|
+ @Test
|
|
46
|
+ public void testThree8(){
|
|
47
|
+ //Given: Setup
|
|
48
|
+ int number=8;
|
|
49
|
+ String expectedOutput= "8";
|
|
50
|
+
|
|
51
|
+ //when (invoke the method under test)
|
|
52
|
+ String actualOutput=FizzBuzz.divisibleByThree(number);
|
|
53
|
+
|
|
54
|
+ //Then
|
|
55
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
56
|
+ }
|
|
57
|
+
|
|
58
|
+ @Test
|
|
59
|
+ public void testFive(){
|
|
60
|
+ //Given Setup
|
|
61
|
+ int number=5;
|
|
62
|
+ String expectedOutput="Buzz";
|
|
63
|
+
|
|
64
|
+ //when
|
|
65
|
+ String actualOutput=FizzBuzz.divisibleByFive(number);
|
|
66
|
+
|
|
67
|
+ //then
|
|
68
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
69
|
+ }
|
|
70
|
+
|
|
71
|
+ @Test
|
|
72
|
+ public void testFive2(){
|
|
73
|
+ //Given Setup
|
|
74
|
+ int number=2;
|
|
75
|
+ String expectedOutput="2";
|
|
76
|
+
|
|
77
|
+ //when
|
|
78
|
+ String actualOutput=FizzBuzz.divisibleByFive(number);
|
|
79
|
+
|
|
80
|
+ //then
|
|
81
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
82
|
+ }
|
|
83
|
+
|
|
84
|
+ @Test
|
|
85
|
+ public void testFive7(){
|
|
86
|
+ //Given Setup
|
|
87
|
+ int number=7;
|
|
88
|
+ String expectedOutput="7";
|
|
89
|
+
|
|
90
|
+ //when
|
|
91
|
+ String actualOutput=FizzBuzz.divisibleByFive(number);
|
|
92
|
+
|
|
93
|
+ //then
|
|
94
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
95
|
+ }
|
|
96
|
+
|
|
97
|
+ @Test
|
|
98
|
+ public void testFive10(){
|
|
99
|
+ //Given Setup
|
|
100
|
+ int number=10;
|
|
101
|
+ String expectedOutput="Buzz";
|
|
102
|
+
|
|
103
|
+ //when
|
|
104
|
+ String actualOutput=FizzBuzz.divisibleByFive(number);
|
|
105
|
+
|
|
106
|
+ //then
|
|
107
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
108
|
+ }
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+ @Test
|
|
112
|
+ public void testFifteen(){
|
|
113
|
+ //given
|
|
114
|
+ int number=15;
|
|
115
|
+ String expectedOutput= "FizzBuzz";
|
|
116
|
+
|
|
117
|
+ //when
|
|
118
|
+
|
|
119
|
+ String actualOutput=FizzBuzz.divisibleByFifteen(number);
|
|
120
|
+
|
|
121
|
+ //then
|
|
122
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+ }
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+ @Test
|
|
129
|
+ public void testFifteen18(){
|
|
130
|
+ //given
|
|
131
|
+ int number=18;
|
|
132
|
+ String expectedOutput= "18";
|
|
133
|
+
|
|
134
|
+ //when
|
|
135
|
+
|
|
136
|
+ String actualOutput=FizzBuzz.divisibleByFifteen(number);
|
|
137
|
+
|
|
138
|
+ //then
|
|
139
|
+ Assert.assertEquals(expectedOutput, actualOutput);
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+ }
|
|
143
|
+
|
|
144
|
+
|
2
|
145
|
}
|
|
146
|
+
|
|
147
|
+
|