Sfoglia il codice sorgente

Merge pull request #1386 from Haozhe321/1365-update-test-for-bowling

Update test for bowling
Sam Warner 8 anni fa
parent
commit
7d610f258a
No account linked to committer's email

+ 1
- 1
exercises/bowling/.meta/version Vedi File

1
-1.1.0
1
+1.2.0

+ 30
- 5
exercises/bowling/src/test/java/BowlingTest.java Vedi File

199
 
199
 
200
         game.score();
200
         game.score();
201
     }
201
     }
202
-    
202
+
203
     @Ignore("Remove to run test")
203
     @Ignore("Remove to run test")
204
     @Test
204
     @Test
205
     public void twoBonusRollsAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
205
     public void twoBonusRollsAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
222
 
222
 
223
         assertEquals(26, game.score());
223
         assertEquals(26, game.score());
224
     }
224
     }
225
-    
225
+
226
     @Ignore("Remove to run test")
226
     @Ignore("Remove to run test")
227
     @Test
227
     @Test
228
     public void theSecondBonusRollsAfterAStrikeInTheLastFrameCanNotBeAStrikeIfTheFirstOneIsNotAStrike() {
228
     public void theSecondBonusRollsAfterAStrikeInTheLastFrameCanNotBeAStrikeIfTheFirstOneIsNotAStrike() {
235
 
235
 
236
         game.score();
236
         game.score();
237
     }
237
     }
238
-    
238
+
239
     @Ignore("Remove to run test")
239
     @Ignore("Remove to run test")
240
     @Test
240
     @Test
241
     public void secondBonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
241
     public void secondBonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
248
 
248
 
249
         game.score();
249
         game.score();
250
     }
250
     }
251
-    
251
+
252
     @Ignore("Remove to run test")
252
     @Ignore("Remove to run test")
253
     @Test
253
     @Test
254
     public void anUnstartedGameCanNotBeScored() {
254
     public void anUnstartedGameCanNotBeScored() {
327
         game.score();
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
+}