瀏覽代碼

Made 12 test for FizzBuzz.

William Brown 6 年之前
父節點
當前提交
c4d1ee984b
共有 6 個文件被更改,包括 138 次插入1 次删除
  1. 二進制
      .DS_Store
  2. 二進制
      src/.DS_Store
  3. 二進制
      src/main/.DS_Store
  4. 3
    0
      src/main/java/FizzBuzz.java
  5. 二進制
      src/test/.DS_Store
  6. 135
    1
      src/test/java/FizzBuzzTest.java

二進制
.DS_Store 查看文件


二進制
src/.DS_Store 查看文件


二進制
src/main/.DS_Store 查看文件


+ 3
- 0
src/main/java/FizzBuzz.java 查看文件

@@ -1,2 +1,5 @@
1 1
 public class FizzBuzz {
2
+    public static String of(int number1) {
3
+        return "";
4
+    }
2 5
 }

二進制
src/test/.DS_Store 查看文件


+ 135
- 1
src/test/java/FizzBuzzTest.java 查看文件

@@ -1,2 +1,136 @@
1
+import org.junit.Assert;
2
+import org.junit.Test;
3
+
1 4
 public class FizzBuzzTest {
2
-}
5
+    @Test
6
+    public void ifThreeAndFiveTest(){
7
+        // Given
8
+        int number1 = 15;
9
+        String expectedNumber = "FizzBuzz";
10
+        //When
11
+        String actualNumber = FizzBuzz.of(number1);
12
+        //then
13
+        Assert.assertEquals(expectedNumber, actualNumber);
14
+    }
15
+
16
+    @Test
17
+    public void ifThreeAndFiveTest2(){
18
+        // Given
19
+        int number1 = 300000000;
20
+        String expectedNumber = "FizzBuzz";
21
+        //When
22
+        String actualNumber = FizzBuzz.of(number1);
23
+        //then
24
+        Assert.assertEquals(expectedNumber, actualNumber);
25
+    }
26
+
27
+    @Test
28
+    public void ifThreeAndFiveTest3(){
29
+        // Given
30
+        int number1 = -3000;
31
+        String expectedNumber = "FizzBuzz";
32
+        //When
33
+        String actualNumber = FizzBuzz.of(number1);
34
+        //then
35
+        Assert.assertEquals(expectedNumber, actualNumber);
36
+    }
37
+
38
+    @Test
39
+    public void ifThreeTest(){
40
+        // Given
41
+        int number1 = 99;
42
+        String expectedNumber = "Fizz";
43
+        //When
44
+        String actualNumber = FizzBuzz.of(number1);
45
+        //then
46
+        Assert.assertEquals(expectedNumber, actualNumber);
47
+    }
48
+
49
+    @Test
50
+    public void ifThreeTest2(){
51
+        // Given
52
+        int number1 = 6;
53
+        String expectedNumber = "Fizz";
54
+        //When
55
+        String actualNumber = FizzBuzz.of(number1);
56
+        //then
57
+        Assert.assertEquals(expectedNumber, actualNumber);
58
+    }
59
+
60
+    @Test
61
+    public void ifThreeTest3(){
62
+        // Given
63
+        int number1 = -24;
64
+        String expectedNumber = "Fizz";
65
+        //When
66
+        String actualNumber = FizzBuzz.of(number1);
67
+        //then
68
+        Assert.assertEquals(expectedNumber, actualNumber);
69
+    }
70
+
71
+    @Test
72
+    public void ifFiveTest(){
73
+        // Given
74
+        int number1 = 25;
75
+        String expectedNumber = "Buzz";
76
+        //When
77
+        String actualNumber = FizzBuzz.of(number1);
78
+        //then
79
+        Assert.assertEquals(expectedNumber, actualNumber);
80
+    }
81
+
82
+    @Test
83
+    public void ifFiveTest2(){
84
+        // Given
85
+        int number1 = 5000;
86
+        String expectedNumber = "Buzz";
87
+        //When
88
+        String actualNumber = FizzBuzz.of(number1);
89
+        //then
90
+        Assert.assertEquals(expectedNumber, actualNumber);
91
+    }
92
+
93
+    @Test
94
+    public void ifFiveTest3(){
95
+        // Given
96
+        int number1 = -95;
97
+        String expectedNumber = "Buzz";
98
+        //When
99
+        String actualNumber = FizzBuzz.of(number1);
100
+        //then
101
+        Assert.assertEquals(expectedNumber, actualNumber);
102
+    }
103
+
104
+    @Test
105
+    public void ifNoneTest(){
106
+        // Given
107
+        int number1 = 0;
108
+        String expectedNumber = "0";
109
+        //When
110
+        String actualNumber = FizzBuzz.of(number1);
111
+        //then
112
+        Assert.assertEquals(expectedNumber, actualNumber);
113
+    }
114
+
115
+    @Test
116
+    public void ifNoneTest2(){
117
+        // Given
118
+        int number1 = -47;
119
+        String expectedNumber = "-47";
120
+        //When
121
+        String actualNumber = FizzBuzz.of(number1);
122
+        //then
123
+        Assert.assertEquals(expectedNumber, actualNumber);
124
+    }
125
+
126
+    @Test
127
+    public void ifNoneTest3(){
128
+        // Given
129
+        int number1 = 574;
130
+        String expectedNumber = "574";
131
+        //When
132
+        String actualNumber = FizzBuzz.of(number1);
133
+        //then
134
+        Assert.assertEquals(expectedNumber, actualNumber);
135
+    }
136
+}