11import org .junit .jupiter .api .Disabled ;
2+ import org .junit .jupiter .api .DisplayName ;
23import org .junit .jupiter .api .Test ;
34
45import static org .assertj .core .api .Assertions .assertThat ;
@@ -14,6 +15,7 @@ private void playGame(int[] rolls) {
1415 }
1516
1617 @ Test
18+ @ DisplayName ("should be able to score a game with all zeros" )
1719 public void shouldBeAbleToScoreAGameWithAllZeros () {
1820 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
1921
@@ -23,6 +25,7 @@ public void shouldBeAbleToScoreAGameWithAllZeros() {
2325
2426 @ Disabled ("Remove to run test" )
2527 @ Test
28+ @ DisplayName ("should be able to score a game with no strikes or spares" )
2629 public void shouldBeAbleToScoreAGameWithNoStrikesOrSpares () {
2730 int [] rolls = {3 , 6 , 3 , 6 , 3 , 6 , 3 , 6 , 3 , 6 , 3 , 6 , 3 , 6 , 3 , 6 , 3 , 6 , 3 , 6 };
2831
@@ -32,6 +35,7 @@ public void shouldBeAbleToScoreAGameWithNoStrikesOrSpares() {
3235
3336 @ Disabled ("Remove to run test" )
3437 @ Test
38+ @ DisplayName ("a spare followed by zeros is worth ten points" )
3539 public void aSpareFollowedByZerosIsWorthTenPoints () {
3640 int [] rolls = {6 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
3741
@@ -41,6 +45,7 @@ public void aSpareFollowedByZerosIsWorthTenPoints() {
4145
4246 @ Disabled ("Remove to run test" )
4347 @ Test
48+ @ DisplayName ("points scored in the roll after a spare are counted twice" )
4449 public void pointsScoredInTheRollAfterASpareAreCountedTwice () {
4550 int [] rolls = {6 , 4 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
4651
@@ -50,6 +55,7 @@ public void pointsScoredInTheRollAfterASpareAreCountedTwice() {
5055
5156 @ Disabled ("Remove to run test" )
5257 @ Test
58+ @ DisplayName ("consecutive spares each get a one roll bonus" )
5359 public void consecutiveSparesEachGetAOneRollBonus () {
5460 int [] rolls = {5 , 5 , 3 , 7 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
5561
@@ -59,6 +65,7 @@ public void consecutiveSparesEachGetAOneRollBonus() {
5965
6066 @ Disabled ("Remove to run test" )
6167 @ Test
68+ @ DisplayName ("a spare in the last frame gets a one roll bonus that is counted once" )
6269 public void aSpareInTheLastFrameGetsAOneRollBonusThatIsCountedOnce () {
6370 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 7 , 3 , 7 };
6471
@@ -68,6 +75,7 @@ public void aSpareInTheLastFrameGetsAOneRollBonusThatIsCountedOnce() {
6875
6976 @ Disabled ("Remove to run test" )
7077 @ Test
78+ @ DisplayName ("a strike earns ten points in a frame with a single roll" )
7179 public void aStrikeEarnsTenPointsInFrameWithASingleRoll () {
7280 int [] rolls = {10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
7381
@@ -77,6 +85,7 @@ public void aStrikeEarnsTenPointsInFrameWithASingleRoll() {
7785
7886 @ Disabled ("Remove to run test" )
7987 @ Test
88+ @ DisplayName ("points scored in the two rolls after a strike are counted twice as a bonus" )
8089 public void pointsScoredInTheTwoRollsAfterAStrikeAreCountedTwiceAsABonus () {
8190 int [] rolls = {10 , 5 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
8291
@@ -86,6 +95,7 @@ public void pointsScoredInTheTwoRollsAfterAStrikeAreCountedTwiceAsABonus() {
8695
8796 @ Disabled ("Remove to run test" )
8897 @ Test
98+ @ DisplayName ("consecutive strikes each get the two roll bonus" )
8999 public void consecutiveStrikesEachGetTheTwoRollBonus () {
90100 int [] rolls = {10 , 10 , 10 , 5 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
91101
@@ -95,6 +105,7 @@ public void consecutiveStrikesEachGetTheTwoRollBonus() {
95105
96106 @ Disabled ("Remove to run test" )
97107 @ Test
108+ @ DisplayName ("a strike in the last frame gets a two roll bonus that is counted once" )
98109 public void aStrikeInTheLastFrameGetsATwoRollBonusThatIsCountedOnce () {
99110 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 7 , 1 };
100111
@@ -104,6 +115,7 @@ public void aStrikeInTheLastFrameGetsATwoRollBonusThatIsCountedOnce() {
104115
105116 @ Disabled ("Remove to run test" )
106117 @ Test
118+ @ DisplayName ("rolling a spare with the two roll bonus does not get a bonus roll" )
107119 public void rollingASpareWithTheTwoRollBonusDoesNotGetABonusRoll () {
108120 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 7 , 3 };
109121
@@ -113,6 +125,7 @@ public void rollingASpareWithTheTwoRollBonusDoesNotGetABonusRoll() {
113125
114126 @ Disabled ("Remove to run test" )
115127 @ Test
128+ @ DisplayName ("strikes with the two roll bonus do not get bonus rolls" )
116129 public void strikesWithTheTwoRollBonusDoNotGetBonusRolls () {
117130 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 10 , 10 };
118131
@@ -122,6 +135,7 @@ public void strikesWithTheTwoRollBonusDoNotGetBonusRolls() {
122135
123136 @ Disabled ("Remove to run test" )
124137 @ Test
138+ @ DisplayName ("last two strikes followed by only last bonus with non strike points" )
125139 public void lastTwoStrikesFollowedByOnlyLastBonusWithNonStrikePoints () {
126140 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 10 , 0 , 1 };
127141
@@ -131,6 +145,7 @@ public void lastTwoStrikesFollowedByOnlyLastBonusWithNonStrikePoints() {
131145
132146 @ Disabled ("Remove to run test" )
133147 @ Test
148+ @ DisplayName ("a strike with the one roll bonus after a spare in the last frame does not get a bonus" )
134149 public void aStrikeWithTheOneRollBonusAfterASpareInTheLastFrameDoesNotGetABonus () {
135150 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 7 , 3 , 10 };
136151
@@ -140,6 +155,7 @@ public void aStrikeWithTheOneRollBonusAfterASpareInTheLastFrameDoesNotGetABonus(
140155
141156 @ Disabled ("Remove to run test" )
142157 @ Test
158+ @ DisplayName ("all strikes is a perfect game" )
143159 public void allStrikesIsAPerfectGame () {
144160 int [] rolls = {10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 };
145161
@@ -149,6 +165,7 @@ public void allStrikesIsAPerfectGame() {
149165
150166 @ Disabled ("Remove to run test" )
151167 @ Test
168+ @ DisplayName ("rolls cannot score negative points" )
152169 public void rollsCanNotScoreNegativePoints () {
153170 int [] rolls = {-1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
154171
@@ -159,6 +176,7 @@ public void rollsCanNotScoreNegativePoints() {
159176
160177 @ Disabled ("Remove to run test" )
161178 @ Test
179+ @ DisplayName ("a roll cannot score more than 10 points" )
162180 public void aRollCanNotScoreMoreThan10Points () {
163181 int [] rolls = {11 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
164182
@@ -169,6 +187,7 @@ public void aRollCanNotScoreMoreThan10Points() {
169187
170188 @ Disabled ("Remove to run test" )
171189 @ Test
190+ @ DisplayName ("two rolls in a frame cannot score more than 10 points" )
172191 public void twoRollsInAFrameCanNotScoreMoreThan10Points () {
173192 int [] rolls = {5 , 6 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
174193
@@ -179,6 +198,7 @@ public void twoRollsInAFrameCanNotScoreMoreThan10Points() {
179198
180199 @ Disabled ("Remove to run test" )
181200 @ Test
201+ @ DisplayName ("bonus roll after a strike in the last frame cannot score more than 10 points" )
182202 public void bonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points () {
183203 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 11 , 0 };
184204
@@ -189,6 +209,7 @@ public void bonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
189209
190210 @ Disabled ("Remove to run test" )
191211 @ Test
212+ @ DisplayName ("two bonus rolls after a strike in the last frame cannot score more than 10 points" )
192213 public void twoBonusRollsAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points () {
193214 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 5 , 6 };
194215
@@ -199,6 +220,7 @@ public void twoBonusRollsAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points()
199220
200221 @ Disabled ("Remove to run test" )
201222 @ Test
223+ @ DisplayName ("two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike" )
202224 public void twoBonusRollsAfterAStrikeInTheLastFrameCanScoreMoreThan10PointsIfOneIsAStrike () {
203225 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 10 , 6 };
204226
@@ -209,6 +231,7 @@ public void twoBonusRollsAfterAStrikeInTheLastFrameCanScoreMoreThan10PointsIfOne
209231
210232 @ Disabled ("Remove to run test" )
211233 @ Test
234+ @ DisplayName ("the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike" )
212235 public void theSecondBonusRollsAfterAStrikeInTheLastFrameCanNotBeAStrikeIfTheFirstOneIsNotAStrike () {
213236 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 6 , 10 };
214237
@@ -219,6 +242,7 @@ public void theSecondBonusRollsAfterAStrikeInTheLastFrameCanNotBeAStrikeIfTheFir
219242
220243 @ Disabled ("Remove to run test" )
221244 @ Test
245+ @ DisplayName ("second bonus roll after a strike in the last frame cannot score more than 10 points" )
222246 public void secondBonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points () {
223247 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 10 , 11 };
224248
@@ -229,6 +253,7 @@ public void secondBonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points
229253
230254 @ Disabled ("Remove to run test" )
231255 @ Test
256+ @ DisplayName ("an unstarted game cannot be scored" )
232257 public void anUnstartedGameCanNotBeScored () {
233258 int [] rolls = new int [0 ];
234259
@@ -241,6 +266,7 @@ public void anUnstartedGameCanNotBeScored() {
241266
242267 @ Disabled ("Remove to run test" )
243268 @ Test
269+ @ DisplayName ("an incomplete game cannot be scored" )
244270 public void anIncompleteGameCanNotBeScored () {
245271 int [] rolls = {0 , 0 };
246272
@@ -253,6 +279,7 @@ public void anIncompleteGameCanNotBeScored() {
253279
254280 @ Disabled ("Remove to run test" )
255281 @ Test
282+ @ DisplayName ("cannot roll if game already has ten frames" )
256283 public void canNotRollIfGameAlreadyHasTenFrames () {
257284 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
258285
@@ -263,6 +290,7 @@ public void canNotRollIfGameAlreadyHasTenFrames() {
263290
264291 @ Disabled ("Remove to run test" )
265292 @ Test
293+ @ DisplayName ("bonus rolls for a strike in the last frame must be rolled before score can be calculated" )
266294 public void bonusRollsForAStrikeInTheLastFrameMustBeRolledBeforeScoreCanBeCalculated () {
267295 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 };
268296
@@ -275,6 +303,7 @@ public void bonusRollsForAStrikeInTheLastFrameMustBeRolledBeforeScoreCanBeCalcul
275303
276304 @ Disabled ("Remove to run test" )
277305 @ Test
306+ @ DisplayName ("both bonus rolls for a strike in the last frame must be rolled before score can be calculated" )
278307 public void bothBonusRollsForAStrikeInTheLastFrameMustBeRolledBeforeScoreCanBeCalculated () {
279308 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 10 };
280309
@@ -287,6 +316,7 @@ public void bothBonusRollsForAStrikeInTheLastFrameMustBeRolledBeforeScoreCanBeCa
287316
288317 @ Disabled ("Remove to run test" )
289318 @ Test
319+ @ DisplayName ("bonus roll for a spare in the last frame must be rolled before score can be calculated" )
290320 public void bonusRollForASpareInTheLastFrameMustBeRolledBeforeScoreCanBeCalculated () {
291321 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 7 , 3 };
292322
@@ -299,6 +329,7 @@ public void bonusRollForASpareInTheLastFrameMustBeRolledBeforeScoreCanBeCalculat
299329
300330 @ Disabled ("Remove to run test" )
301331 @ Test
332+ @ DisplayName ("cannot roll after bonus roll for spare" )
302333 public void canNotRollAfterBonusRollForSpare () {
303334 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 7 , 3 , 2 , 2 };
304335
@@ -309,6 +340,7 @@ public void canNotRollAfterBonusRollForSpare() {
309340
310341 @ Disabled ("Remove to run test" )
311342 @ Test
343+ @ DisplayName ("cannot roll after bonus rolls for strike" )
312344 public void canNotRollAfterBonusRollForStrike () {
313345 int [] rolls = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 10 , 3 , 2 , 2 };
314346
0 commit comments