瀏覽代碼

Merge pull request #332 from michaelspets/beers318

beer-song: split tests per assertion [Fix #318]
FridaTveit 9 年之前
父節點
當前提交
6505d73f45
共有 1 個檔案被更改,包括 24 行新增6 行删除
  1. 24
    6
      exercises/beer-song/src/test/java/BeerSongTest.java

+ 24
- 6
exercises/beer-song/src/test/java/BeerSongTest.java 查看文件

5
 
5
 
6
 public class BeerSongTest {
6
 public class BeerSongTest {
7
 
7
 
8
+    @Test
9
+    public void singFirstVerse() {
10
+        assertEquals("99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n", BeerSong.verse(99));
11
+    }
12
+
13
+    @Ignore
14
+    @Test
15
+    public void singMiddleVerse() {
16
+        assertEquals("44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n", BeerSong.verse(44));
17
+    }
8
 
18
 
19
+    @Ignore
9
     @Test
20
     @Test
10
-    public void singOneVerse() {
11
-        assertEquals("8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n", BeerSong.verse(8));
21
+    public void singThirdToLastVerse() {
12
         assertEquals("2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n", BeerSong.verse(2));
22
         assertEquals("2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n", BeerSong.verse(2));
23
+    }
24
+
25
+    @Ignore
26
+    @Test
27
+    public void singPenultimateVerse() {
13
         assertEquals("1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\n", BeerSong.verse(1));
28
         assertEquals("1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\n", BeerSong.verse(1));
14
-        assertEquals("No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n\n", BeerSong.verse(0));
29
+    }
15
 
30
 
31
+    @Ignore
32
+    @Test
33
+    public void singLastVerse() {
34
+        assertEquals("No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n\n", BeerSong.verse(0));
16
     }
35
     }
17
 
36
 
18
     @Ignore
37
     @Ignore
19
     @Test
38
     @Test
20
-    public void singMoreThanOneVerse() {
21
-        assertEquals("8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n", BeerSong.sing(8,6));
22
-        assertEquals("3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n\n",BeerSong.sing(3,0));
39
+    public void singLastFourVerses() {
40
+        assertEquals("3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n\n", BeerSong.sing(3,0));
23
     }
41
     }
24
 
42
 
25
     @Ignore
43
     @Ignore