diff --git a/exercises/practice/bottle-song/src/test/java/BottleSongTest.java b/exercises/practice/bottle-song/src/test/java/BottleSongTest.java index a47a7edc8..7d5ce0a97 100644 --- a/exercises/practice/bottle-song/src/test/java/BottleSongTest.java +++ b/exercises/practice/bottle-song/src/test/java/BottleSongTest.java @@ -1,6 +1,7 @@ -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -14,6 +15,7 @@ public void setup() { } @Test + @DisplayName("first generic verse") public void firstGenericVerse() { assertThat(bottleSong.recite(10, 1)).isEqualTo( "Ten green bottles hanging on the wall,\n" + @@ -25,6 +27,7 @@ public void firstGenericVerse() { @Disabled("Remove to run test") @Test + @DisplayName("last generic verse") public void lastGenericVerse() { assertThat(bottleSong.recite(3, 1)).isEqualTo( "Three green bottles hanging on the wall,\n" + @@ -36,6 +39,7 @@ public void lastGenericVerse() { @Disabled("Remove to run test") @Test + @DisplayName("verse with 2 bottles") public void verseWithTwoBottles() { assertThat(bottleSong.recite(2, 1)).isEqualTo( "Two green bottles hanging on the wall,\n" + @@ -47,6 +51,7 @@ public void verseWithTwoBottles() { @Disabled("Remove to run test") @Test + @DisplayName("verse with 1 bottle") public void verseWithOneBottle() { assertThat(bottleSong.recite(1, 1)).isEqualTo( "One green bottle hanging on the wall,\n" + @@ -58,6 +63,7 @@ public void verseWithOneBottle() { @Disabled("Remove to run test") @Test + @DisplayName("first two verses") public void firstTwoVerses() { assertThat(bottleSong.recite(10, 2)).isEqualTo( "Ten green bottles hanging on the wall,\n" + @@ -74,6 +80,7 @@ public void firstTwoVerses() { @Disabled("Remove to run test") @Test + @DisplayName("last three verses") public void lastThreeVerses() { assertThat(bottleSong.recite(3, 3)).isEqualTo( "Three green bottles hanging on the wall,\n" + @@ -95,6 +102,7 @@ public void lastThreeVerses() { @Disabled("Remove to run test") @Test + @DisplayName("all verses") public void allVerses() { assertThat(bottleSong.recite(10, 10)) .isEqualTo( diff --git a/exercises/practice/bowling/src/test/java/BowlingGameTest.java b/exercises/practice/bowling/src/test/java/BowlingGameTest.java index 7b63a4fc1..a8fbcad96 100644 --- a/exercises/practice/bowling/src/test/java/BowlingGameTest.java +++ b/exercises/practice/bowling/src/test/java/BowlingGameTest.java @@ -1,4 +1,5 @@ import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -14,6 +15,7 @@ private void playGame(int[] rolls) { } @Test + @DisplayName("should be able to score a game with all zeros") public void shouldBeAbleToScoreAGameWithAllZeros() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -23,6 +25,7 @@ public void shouldBeAbleToScoreAGameWithAllZeros() { @Disabled("Remove to run test") @Test + @DisplayName("should be able to score a game with no strikes or spares") public void shouldBeAbleToScoreAGameWithNoStrikesOrSpares() { int[] rolls = {3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6}; @@ -32,6 +35,7 @@ public void shouldBeAbleToScoreAGameWithNoStrikesOrSpares() { @Disabled("Remove to run test") @Test + @DisplayName("a spare followed by zeros is worth ten points") public void aSpareFollowedByZerosIsWorthTenPoints() { int[] rolls = {6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -41,6 +45,7 @@ public void aSpareFollowedByZerosIsWorthTenPoints() { @Disabled("Remove to run test") @Test + @DisplayName("points scored in the roll after a spare are counted twice") public void pointsScoredInTheRollAfterASpareAreCountedTwice() { int[] rolls = {6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -50,6 +55,7 @@ public void pointsScoredInTheRollAfterASpareAreCountedTwice() { @Disabled("Remove to run test") @Test + @DisplayName("consecutive spares each get a one roll bonus") public void consecutiveSparesEachGetAOneRollBonus() { int[] rolls = {5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -59,6 +65,7 @@ public void consecutiveSparesEachGetAOneRollBonus() { @Disabled("Remove to run test") @Test + @DisplayName("a spare in the last frame gets a one roll bonus that is counted once") public void aSpareInTheLastFrameGetsAOneRollBonusThatIsCountedOnce() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7}; @@ -68,6 +75,7 @@ public void aSpareInTheLastFrameGetsAOneRollBonusThatIsCountedOnce() { @Disabled("Remove to run test") @Test + @DisplayName("a strike earns ten points in a frame with a single roll") public void aStrikeEarnsTenPointsInFrameWithASingleRoll() { int[] rolls = {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -77,6 +85,7 @@ public void aStrikeEarnsTenPointsInFrameWithASingleRoll() { @Disabled("Remove to run test") @Test + @DisplayName("points scored in the two rolls after a strike are counted twice as a bonus") public void pointsScoredInTheTwoRollsAfterAStrikeAreCountedTwiceAsABonus() { int[] rolls = {10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -86,6 +95,7 @@ public void pointsScoredInTheTwoRollsAfterAStrikeAreCountedTwiceAsABonus() { @Disabled("Remove to run test") @Test + @DisplayName("consecutive strikes each get the two roll bonus") public void consecutiveStrikesEachGetTheTwoRollBonus() { int[] rolls = {10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -95,6 +105,7 @@ public void consecutiveStrikesEachGetTheTwoRollBonus() { @Disabled("Remove to run test") @Test + @DisplayName("a strike in the last frame gets a two roll bonus that is counted once") public void aStrikeInTheLastFrameGetsATwoRollBonusThatIsCountedOnce() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1}; @@ -104,6 +115,7 @@ public void aStrikeInTheLastFrameGetsATwoRollBonusThatIsCountedOnce() { @Disabled("Remove to run test") @Test + @DisplayName("rolling a spare with the two roll bonus does not get a bonus roll") public void rollingASpareWithTheTwoRollBonusDoesNotGetABonusRoll() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3}; @@ -113,6 +125,7 @@ public void rollingASpareWithTheTwoRollBonusDoesNotGetABonusRoll() { @Disabled("Remove to run test") @Test + @DisplayName("strikes with the two roll bonus do not get bonus rolls") public void strikesWithTheTwoRollBonusDoNotGetBonusRolls() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10}; @@ -122,6 +135,7 @@ public void strikesWithTheTwoRollBonusDoNotGetBonusRolls() { @Disabled("Remove to run test") @Test + @DisplayName("last two strikes followed by only last bonus with non strike points") public void lastTwoStrikesFollowedByOnlyLastBonusWithNonStrikePoints() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 1}; @@ -131,6 +145,7 @@ public void lastTwoStrikesFollowedByOnlyLastBonusWithNonStrikePoints() { @Disabled("Remove to run test") @Test + @DisplayName("a strike with the one roll bonus after a spare in the last frame does not get a bonus") public void aStrikeWithTheOneRollBonusAfterASpareInTheLastFrameDoesNotGetABonus() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10}; @@ -140,6 +155,7 @@ public void aStrikeWithTheOneRollBonusAfterASpareInTheLastFrameDoesNotGetABonus( @Disabled("Remove to run test") @Test + @DisplayName("all strikes is a perfect game") public void allStrikesIsAPerfectGame() { int[] rolls = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}; @@ -149,6 +165,7 @@ public void allStrikesIsAPerfectGame() { @Disabled("Remove to run test") @Test + @DisplayName("rolls cannot score negative points") public void rollsCanNotScoreNegativePoints() { int[] rolls = {-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -159,6 +176,7 @@ public void rollsCanNotScoreNegativePoints() { @Disabled("Remove to run test") @Test + @DisplayName("a roll cannot score more than 10 points") public void aRollCanNotScoreMoreThan10Points() { int[] rolls = {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -169,6 +187,7 @@ public void aRollCanNotScoreMoreThan10Points() { @Disabled("Remove to run test") @Test + @DisplayName("two rolls in a frame cannot score more than 10 points") public void twoRollsInAFrameCanNotScoreMoreThan10Points() { int[] rolls = {5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -179,6 +198,7 @@ public void twoRollsInAFrameCanNotScoreMoreThan10Points() { @Disabled("Remove to run test") @Test + @DisplayName("bonus roll after a strike in the last frame cannot score more than 10 points") public void bonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 0}; @@ -189,6 +209,7 @@ public void bonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() { @Disabled("Remove to run test") @Test + @DisplayName("two bonus rolls after a strike in the last frame cannot score more than 10 points") public void twoBonusRollsAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5, 6}; @@ -199,6 +220,7 @@ public void twoBonusRollsAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() @Disabled("Remove to run test") @Test + @DisplayName("two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike") public void twoBonusRollsAfterAStrikeInTheLastFrameCanScoreMoreThan10PointsIfOneIsAStrike() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6}; @@ -209,6 +231,9 @@ public void twoBonusRollsAfterAStrikeInTheLastFrameCanScoreMoreThan10PointsIfOne @Disabled("Remove to run test") @Test + @DisplayName( + "the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike" + ) public void theSecondBonusRollsAfterAStrikeInTheLastFrameCanNotBeAStrikeIfTheFirstOneIsNotAStrike() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6, 10}; @@ -219,6 +244,7 @@ public void theSecondBonusRollsAfterAStrikeInTheLastFrameCanNotBeAStrikeIfTheFir @Disabled("Remove to run test") @Test + @DisplayName("second bonus roll after a strike in the last frame cannot score more than 10 points") public void secondBonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 11}; @@ -229,6 +255,7 @@ public void secondBonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points @Disabled("Remove to run test") @Test + @DisplayName("an unstarted game cannot be scored") public void anUnstartedGameCanNotBeScored() { int[] rolls = new int[0]; @@ -241,6 +268,7 @@ public void anUnstartedGameCanNotBeScored() { @Disabled("Remove to run test") @Test + @DisplayName("an incomplete game cannot be scored") public void anIncompleteGameCanNotBeScored() { int[] rolls = {0, 0}; @@ -253,6 +281,7 @@ public void anIncompleteGameCanNotBeScored() { @Disabled("Remove to run test") @Test + @DisplayName("cannot roll if game already has ten frames") public void canNotRollIfGameAlreadyHasTenFrames() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -263,6 +292,7 @@ public void canNotRollIfGameAlreadyHasTenFrames() { @Disabled("Remove to run test") @Test + @DisplayName("bonus rolls for a strike in the last frame must be rolled before score can be calculated") public void bonusRollsForAStrikeInTheLastFrameMustBeRolledBeforeScoreCanBeCalculated() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}; @@ -275,6 +305,7 @@ public void bonusRollsForAStrikeInTheLastFrameMustBeRolledBeforeScoreCanBeCalcul @Disabled("Remove to run test") @Test + @DisplayName("both bonus rolls for a strike in the last frame must be rolled before score can be calculated") public void bothBonusRollsForAStrikeInTheLastFrameMustBeRolledBeforeScoreCanBeCalculated() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10}; @@ -287,6 +318,7 @@ public void bothBonusRollsForAStrikeInTheLastFrameMustBeRolledBeforeScoreCanBeCa @Disabled("Remove to run test") @Test + @DisplayName("bonus roll for a spare in the last frame must be rolled before score can be calculated") public void bonusRollForASpareInTheLastFrameMustBeRolledBeforeScoreCanBeCalculated() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3}; @@ -299,6 +331,7 @@ public void bonusRollForASpareInTheLastFrameMustBeRolledBeforeScoreCanBeCalculat @Disabled("Remove to run test") @Test + @DisplayName("cannot roll after bonus roll for spare") public void canNotRollAfterBonusRollForSpare() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2, 2}; @@ -309,6 +342,7 @@ public void canNotRollAfterBonusRollForSpare() { @Disabled("Remove to run test") @Test + @DisplayName("cannot roll after bonus rolls for strike") public void canNotRollAfterBonusRollForStrike() { int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2, 2}; diff --git a/exercises/practice/change/src/test/java/ChangeCalculatorTest.java b/exercises/practice/change/src/test/java/ChangeCalculatorTest.java index e685c28d0..b88c316d3 100644 --- a/exercises/practice/change/src/test/java/ChangeCalculatorTest.java +++ b/exercises/practice/change/src/test/java/ChangeCalculatorTest.java @@ -1,4 +1,5 @@ import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import static java.util.Arrays.asList; @@ -8,7 +9,8 @@ public class ChangeCalculatorTest { @Test - public void testChangeFor1Cent() { + @DisplayName("change for 1 cent") + public void testChangeForOneCent() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 5, 10, 25)); assertThat(changeCalculator.computeMostEfficientChange(1)) @@ -17,6 +19,7 @@ public void testChangeFor1Cent() { @Disabled("Remove to run test") @Test + @DisplayName("single coin change") public void testChangeThatCanBeGivenInASingleCoin() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 5, 10, 25, 100)); @@ -26,6 +29,7 @@ public void testChangeThatCanBeGivenInASingleCoin() { @Disabled("Remove to run test") @Test + @DisplayName("multiple coin change") public void testChangeThatMustBeGivenInMultipleCoins() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 5, 10, 25, 100)); @@ -35,6 +39,7 @@ public void testChangeThatMustBeGivenInMultipleCoins() { @Disabled("Remove to run test") @Test + @DisplayName("change with Lilliputian Coins") public void testLilliputianCurrency() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 4, 15, 20, 50)); @@ -44,6 +49,7 @@ public void testLilliputianCurrency() { @Disabled("Remove to run test") @Test + @DisplayName("change with Lower Elbonia Coins") public void testLowerElbonianCurrency() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 5, 10, 21, 25)); @@ -53,6 +59,7 @@ public void testLowerElbonianCurrency() { @Disabled("Remove to run test") @Test + @DisplayName("large target values") public void testLargeAmountOfChange() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 2, 5, 10, 20, 50, 100)); @@ -62,6 +69,7 @@ public void testLargeAmountOfChange() { @Disabled("Remove to run test") @Test + @DisplayName("possible change without unit coins available") public void testPossibleChangeWithoutUnitCoinAvailable() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(2, 5, 10, 20, 50)); @@ -71,6 +79,7 @@ public void testPossibleChangeWithoutUnitCoinAvailable() { @Disabled("Remove to run test") @Test + @DisplayName("another possible change without unit coins available") public void testAnotherPossibleChangeWithoutUnitCoinAvailable() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(4, 5)); @@ -80,6 +89,7 @@ public void testAnotherPossibleChangeWithoutUnitCoinAvailable() { @Disabled("Remove to run test") @Test + @DisplayName("a greedy approach is not optimal") public void testAGreedyApproachIsNotOptimal() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 10, 11)); @@ -89,6 +99,7 @@ public void testAGreedyApproachIsNotOptimal() { @Disabled("Remove to run test") @Test + @DisplayName("no coins make 0 change") public void testZeroChange() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 5, 10, 21, 25)); @@ -98,6 +109,7 @@ public void testZeroChange() { @Disabled("Remove to run test") @Test + @DisplayName("error testing for change smaller than the smallest of coins") public void testChangeLessThanSmallestCoinInCurrencyCannotBeRepresented() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(5, 10)); @@ -108,6 +120,7 @@ public void testChangeLessThanSmallestCoinInCurrencyCannotBeRepresented() { @Disabled("Remove to run test") @Test + @DisplayName("error if no combination can add up to target") public void testChangeLargerThanAllCoinsInCurrencyThatCannotBeRepresented() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(5, 10)); @@ -118,6 +131,7 @@ public void testChangeLargerThanAllCoinsInCurrencyThatCannotBeRepresented() { @Disabled("Remove to run test") @Test + @DisplayName("cannot find negative change values") public void testNegativeChangeIsRejected() { ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 2, 5));