Skip to content

Commit cdd18b3

Browse files
Added test cases
1 parent 40639ea commit cdd18b3

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

‎exercises/bowling/.meta/version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.1.0

‎exercises/bowling/src/test/java/BowlingTest.java‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,19 @@ public void twoRollsInAFrameCanNotScoreMoreThan10Points() {
187187
game.score();
188188
}
189189

190+
@Ignore("Remove to run test")
191+
@Test
192+
public void bonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
193+
int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11};
194+
195+
playGame(rolls);
196+
197+
expectedException.expect(IllegalStateException.class);
198+
expectedException.expectMessage("Pin count exceeds pins on the lane");
199+
200+
game.score();
201+
}
202+
190203
@Ignore("Remove to run test")
191204
@Test
192205
public void twoBonusRollsAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
@@ -209,7 +222,33 @@ public void twoBonusRollsAfterAStrikeInTheLastFrameCanScoreMoreThan10PointsIfOne
209222

210223
assertEquals(26, game.score());
211224
}
225+
226+
@Ignore("Remove to run test")
227+
@Test
228+
public void theSecondBonusRollsAfterAStrikeInTheLastFrameCanNotBeAStrikeIfTheFirstOneIsNotAStrike() {
229+
int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6, 10};
212230

231+
playGame(rolls);
232+
233+
expectedException.expect(IllegalStateException.class);
234+
expectedException.expectMessage("Pin count exceeds pins on the lane");
235+
236+
game.score();
237+
}
238+
239+
@Ignore("Remove to run test")
240+
@Test
241+
public void secondBonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
242+
int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 11};
243+
244+
playGame(rolls);
245+
246+
expectedException.expect(IllegalStateException.class);
247+
expectedException.expectMessage("Pin count exceeds pins on the lane");
248+
249+
game.score();
250+
}
251+
213252
@Ignore("Remove to run test")
214253
@Test
215254
public void anUnstartedGameCanNotBeScored() {
@@ -238,7 +277,7 @@ public void anIncompleteGameCanNotBeScored() {
238277

239278
@Ignore("Remove to run test")
240279
@Test
241-
public void aGameWithMoreThanTenFramesCanNotBeScored() {
280+
public void canNotRollIfGameAlreadyHasTenFrames() {
242281
int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
243282

244283
playGame(rolls);

0 commit comments

Comments
 (0)