Haozhe пре 8 година
родитељ
комит
5c81e971c4
2 измењених фајлова са 31 додато и 6 уклоњено
  1. 1
    1
      exercises/bowling/.meta/version
  2. 30
    5
      exercises/bowling/src/test/java/BowlingTest.java

+ 1
- 1
exercises/bowling/.meta/version Прегледај датотеку

@@ -1 +1 @@
1
-1.1.0
1
+1.2.0

+ 30
- 5
exercises/bowling/src/test/java/BowlingTest.java Прегледај датотеку

@@ -199,7 +199,7 @@ public class BowlingTest {
199 199
 
200 200
         game.score();
201 201
     }
202
-    
202
+
203 203
     @Ignore("Remove to run test")
204 204
     @Test
205 205
     public void twoBonusRollsAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
@@ -222,7 +222,7 @@ public class BowlingTest {
222 222
 
223 223
         assertEquals(26, game.score());
224 224
     }
225
-    
225
+
226 226
     @Ignore("Remove to run test")
227 227
     @Test
228 228
     public void theSecondBonusRollsAfterAStrikeInTheLastFrameCanNotBeAStrikeIfTheFirstOneIsNotAStrike() {
@@ -235,7 +235,7 @@ public class BowlingTest {
235 235
 
236 236
         game.score();
237 237
     }
238
-    
238
+
239 239
     @Ignore("Remove to run test")
240 240
     @Test
241 241
     public void secondBonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
@@ -248,7 +248,7 @@ public class BowlingTest {
248 248
 
249 249
         game.score();
250 250
     }
251
-    
251
+
252 252
     @Ignore("Remove to run test")
253 253
     @Test
254 254
     public void anUnstartedGameCanNotBeScored() {
@@ -327,4 +327,29 @@ public class BowlingTest {
327 327
         game.score();
328 328
     }
329 329
 
330
-}
330
+    @Ignore("Remove to run test")
331
+    @Test
332
+    public void canNotRollAfterBonusRollForSpare() {
333
+        int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2, 2};
334
+
335
+        playGame(rolls);
336
+
337
+        expectedException.expect(IllegalStateException.class);
338
+        expectedException.expectMessage("Cannot roll after game is over");
339
+
340
+        game.score();
341
+    }
342
+
343
+    @Ignore("Remove to run test")
344
+    @Test
345
+    public void canNotRollAfterBonusRollForStrike() {
346
+        int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2, 2};
347
+
348
+        playGame(rolls);
349
+
350
+        expectedException.expect(IllegalStateException.class);
351
+        expectedException.expectMessage("Cannot roll after game is over");
352
+
353
+        game.score();
354
+    }
355
+}