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