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