From 29f2d68d093daae5dcd2421a339c7e34dd9c4c73 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Mon, 17 Nov 2025 23:46:22 +0530 Subject: [PATCH 01/22] Added DisplayName to DnDCharacterTest --- .../src/test/java/DnDCharacterTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/exercises/practice/dnd-character/src/test/java/DnDCharacterTest.java b/exercises/practice/dnd-character/src/test/java/DnDCharacterTest.java index 1c9afc921..203c1f7b4 100644 --- a/exercises/practice/dnd-character/src/test/java/DnDCharacterTest.java +++ b/exercises/practice/dnd-character/src/test/java/DnDCharacterTest.java @@ -1,4 +1,5 @@ import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.List; @@ -10,150 +11,175 @@ public class DnDCharacterTest { private DnDCharacter dndCharacter = new DnDCharacter(); @Test + @DisplayName("Ability modifier for score 3 is -4") public void testAbilityModifierForScore3IsNegative4() { assertThat(dndCharacter.modifier(3)).isEqualTo(-4); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 4 is -3") public void testAbilityModifierForScore4IsNegative3() { assertThat(dndCharacter.modifier(4)).isEqualTo(-3); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 5 is -3") public void testAbilityModifierForScore5IsNegative3() { assertThat(dndCharacter.modifier(5)).isEqualTo(-3); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 6 is -2") public void testAbilityModifierForScore6IsNegative2() { assertThat(dndCharacter.modifier(6)).isEqualTo(-2); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 7 is -2") public void testAbilityModifierForScore7IsNegative2() { assertThat(dndCharacter.modifier(7)).isEqualTo(-2); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 8 is -1") public void testAbilityModifierForScore8IsNegative1() { assertThat(dndCharacter.modifier(8)).isEqualTo(-1); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 9 is -1") public void testAbilityModifierForScore9IsNegative1() { assertThat(dndCharacter.modifier(9)).isEqualTo(-1); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 10 is 0") public void testAbilityModifierForScore10Is0() { assertThat(dndCharacter.modifier(10)).isEqualTo(0); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 11 is 0") public void testAbilityModifierForScore11Is0() { assertThat(dndCharacter.modifier(11)).isEqualTo(0); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 12 is 1") public void testAbilityModifierForScore12Is1() { assertThat(dndCharacter.modifier(12)).isEqualTo(1); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 13 is 1") public void testAbilityModifierForScore13Is1() { assertThat(dndCharacter.modifier(13)).isEqualTo(1); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 14 is 2") public void testAbilityModifierForScore14Is2() { assertThat(dndCharacter.modifier(14)).isEqualTo(2); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 15 is 2") public void testAbilityModifierForScore15Is2() { assertThat(dndCharacter.modifier(15)).isEqualTo(2); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 16 is 3") public void testAbilityModifierForScore16Is3() { assertThat(dndCharacter.modifier(16)).isEqualTo(3); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 17 is 3") public void testAbilityModifierForScore17Is3() { assertThat(dndCharacter.modifier(17)).isEqualTo(3); } @Disabled("Remove to run test") @Test + @DisplayName("Ability modifier for score 18 is 4") public void testAbilityModifierForScore18Is4() { assertThat(dndCharacter.modifier(18)).isEqualTo(4); } @Disabled("Remove to run test") @Test + @DisplayName("Rolling uses 4 dice") public void test4DiceWereUsedForRollingScores() { assertThat(dndCharacter.rollDice().size()).isEqualTo(4); } @Disabled("Remove to run test") @Test + @DisplayName("Dice values are between 1 and 6 inclusive") public void testDiceValuesBetween1And6() { assertThat(dndCharacter.rollDice()).allMatch(d -> d >= 1 && d <= 6); } @Disabled("Remove to run test") @Test + @DisplayName("Ability uses 3 largest numbers from scores in descending order") public void testAbilityCalculationsUses3LargestNumbersFromScoresInDescendingOrder() { assertThat(dndCharacter.ability(List.of(4, 3, 2, 1))).isEqualTo(9); } @Disabled("Remove to run test") @Test + @DisplayName("Ability uses 3 largest numbers from scores in ascending order") public void testAbilityCalculationsUses3LargestNumbersFromFromScoresInAscendingOrder() { assertThat(dndCharacter.ability(List.of(1, 2, 3, 4))).isEqualTo(9); } @Disabled("Remove to run test") @Test + @DisplayName("Ability uses 3 largest numbers from scores in random order") public void testAbilityCalculationsUses3LargestNumbersFromScoresInRandomOrder() { assertThat(dndCharacter.ability(List.of(2, 4, 3, 1))).isEqualTo(9); } @Disabled("Remove to run test") @Test + @DisplayName("Ability with all lowest equal numbers yields 3") public void testAbilityCalculationsWithLowestEqualNumbers() { assertThat(dndCharacter.ability(List.of(1, 1, 1, 1))).isEqualTo(3); } @Disabled("Remove to run test") @Test + @DisplayName("Ability with all highest equal numbers yields 18") public void testAbilityCalculationsWithHighestEqualNumbers() { assertThat(dndCharacter.ability(List.of(6, 6, 6, 6))).isEqualTo(18); } @Disabled("Remove to run test") @Test + @DisplayName("Ability calculation with two lowest numbers") public void testAbilityCalculationsWithTwoLowestNumbers() { assertThat(dndCharacter.ability(List.of(3, 5, 3, 4))).isEqualTo(12); } @Disabled("Remove to run test") @Test + @DisplayName("Ability calculation does not mutate input scores") public void testAbilityCalculationDoesNotChangeInputScores() { List scores = List.of(1, 2, 3, 4); dndCharacter.ability(scores); @@ -164,6 +190,7 @@ public void testAbilityCalculationDoesNotChangeInputScores() { @Disabled("Remove to run test") @Test + @DisplayName("Random character attributes are within valid range") public void testRandomCharacterIsValid() { for (int i = 0; i < 1000; i++) { DnDCharacter character = new DnDCharacter(); @@ -179,6 +206,7 @@ public void testRandomCharacterIsValid() { @Disabled("Remove to run test") @Test + @DisplayName("Each ability value is calculated only once") public void testEachAbilityIsOnlyCalculatedOnce() { assertThat(dndCharacter.getStrength()).isEqualTo(dndCharacter.getStrength()); assertThat(dndCharacter.getDexterity()).isEqualTo(dndCharacter.getDexterity()); @@ -190,6 +218,7 @@ public void testEachAbilityIsOnlyCalculatedOnce() { @Disabled("Remove to run test") @Test + @DisplayName("Each randomly created character should be unique in attributes") public void testUniqueCharacterIsCreated() { DnDCharacter uniqueDnDCharacter = new DnDCharacter(); for (int i = 0; i < 1000; i++) { From cf13ec24607295b6019180a269936b7e3d7d67ce Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:11:38 +0530 Subject: [PATCH 02/22] Added DisplayName to SimpleLinkedListTest --- .../src/test/java/SimpleLinkedListTest.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/exercises/practice/simple-linked-list/src/test/java/SimpleLinkedListTest.java b/exercises/practice/simple-linked-list/src/test/java/SimpleLinkedListTest.java index 76e219ff8..6c047de92 100644 --- a/exercises/practice/simple-linked-list/src/test/java/SimpleLinkedListTest.java +++ b/exercises/practice/simple-linked-list/src/test/java/SimpleLinkedListTest.java @@ -1,14 +1,16 @@ -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.NoSuchElementException; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + public class SimpleLinkedListTest { @Test + @DisplayName("A new list is empty with size zero") public void aNewListIsEmpty() { SimpleLinkedList list = new SimpleLinkedList<>(); assertThat(list.size()).isEqualTo(0); @@ -16,6 +18,7 @@ public void aNewListIsEmpty() { @Disabled("Remove to run test") @Test + @DisplayName("Create list from array sets correct size") public void canCreateFromArray() { Character[] values = new Character[]{'1', '2', '3'}; SimpleLinkedList list = new SimpleLinkedList(values); @@ -24,6 +27,7 @@ public void canCreateFromArray() { @Disabled("Remove to run test") @Test + @DisplayName("Popping an empty list throws NoSuchElementException") public void popOnEmptyListWillThrow() { SimpleLinkedList list = new SimpleLinkedList(); @@ -32,6 +36,7 @@ public void popOnEmptyListWillThrow() { @Disabled("Remove to run test") @Test + @DisplayName("Pop returns last added element (LIFO)") public void popReturnsLastAddedElement() { SimpleLinkedList list = new SimpleLinkedList(); list.push(9); @@ -44,6 +49,7 @@ public void popReturnsLastAddedElement() { @Disabled("Remove to run test") @Test + @DisplayName("Reverse reverses the list order") public void reverseReversesList() { SimpleLinkedList list = new SimpleLinkedList(); list.push("9"); @@ -61,6 +67,7 @@ public void reverseReversesList() { @Disabled("Remove to run test") @Test + @DisplayName("Convert list to array returns correct element order") public void canReturnListAsArray() { SimpleLinkedList list = new SimpleLinkedList(); list.push('9'); @@ -74,6 +81,7 @@ public void canReturnListAsArray() { @Disabled("Remove to run test") @Test + @DisplayName("Empty list as array returns empty array") public void canReturnEmptyListAsEmptyArray() { SimpleLinkedList list = new SimpleLinkedList(); Object[] expected = {}; From 1ec5bfa6baf2e5bfb0ba354e2c8d6a911057bae5 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:12:40 +0530 Subject: [PATCH 03/22] Added DisplayName to RobotTest --- .../robot-name/src/test/java/RobotTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/exercises/practice/robot-name/src/test/java/RobotTest.java b/exercises/practice/robot-name/src/test/java/RobotTest.java index 6c19ae877..26d1f1520 100644 --- a/exercises/practice/robot-name/src/test/java/RobotTest.java +++ b/exercises/practice/robot-name/src/test/java/RobotTest.java @@ -1,11 +1,12 @@ -import static org.assertj.core.api.Assertions.assertThat; +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 java.util.HashSet; import java.util.Set; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; public class RobotTest { @@ -18,24 +19,28 @@ public void setUp() { } @Test + @DisplayName("Robot has a valid name matching the pattern") public void hasName() { assertIsValidName(robot.getName()); } @Test @Disabled("Remove to run test") + @DisplayName("Same robot returns the same name on repeated calls") public void sameRobotsHaveSameNames() { assertThat(robot.getName()).isEqualTo(robot.getName()); } @Disabled("Remove to run test") @Test + @DisplayName("Different robots have different names") public void differentRobotsHaveDifferentNames() { assertThat(robot.getName()).isNotEqualTo(new Robot().getName()); } @Disabled("Remove to run test") @Test + @DisplayName("Resetting a robot assigns a new valid name") public void resetName() { final String name = robot.getName(); robot.reset(); @@ -46,6 +51,7 @@ public void resetName() { @Disabled("Remove to run test") @Test + @DisplayName("Robot names are unique in a large sample") public void robotNamesAreUnique() { Set robotNames = new HashSet<>(); int sampleSize = 5000; From abeab3c6148ce0c993726a75ddd606e19cd80549 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:14:04 +0530 Subject: [PATCH 04/22] Added DisplayName to PokerTest --- .../poker/src/test/java/PokerTest.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/exercises/practice/poker/src/test/java/PokerTest.java b/exercises/practice/poker/src/test/java/PokerTest.java index 016889229..a87b697ec 100644 --- a/exercises/practice/poker/src/test/java/PokerTest.java +++ b/exercises/practice/poker/src/test/java/PokerTest.java @@ -1,4 +1,5 @@ import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.Arrays; @@ -8,6 +9,7 @@ public class PokerTest { @Test + @DisplayName("Single hand returns itself as best hand") public void oneHand() { String hand = "4S 5S 7H 8D JC"; assertThat(new Poker(Collections.singletonList(hand)).getBestHands()) @@ -16,6 +18,7 @@ public void oneHand() { @Disabled("Remove to run test") @Test + @DisplayName("Highest single high card wins") public void highestCardWins() { String highest8 = "4D 5S 6S 8D 3C"; String highest10 = "2S 4C 7S 9H 10H"; @@ -26,6 +29,7 @@ public void highestCardWins() { @Disabled("Remove to run test") @Test + @DisplayName("Tie results in multiple winners") public void tieHasMultipleWinners() { String highest8 = "4D 5S 6S 8D 3C"; String highest10 = "2S 4C 7S 9H 10H"; @@ -37,6 +41,7 @@ public void tieHasMultipleWinners() { @Disabled("Remove to run test") @Test + @DisplayName("Same high cards compared by next highest card") public void sameHighCards() { String nextHighest3 = "3S 5H 6S 8D 7H"; String nextHighest2 = "2S 5D 6D 8C 7S"; @@ -46,6 +51,7 @@ public void sameHighCards() { @Disabled("Remove to run test") @Test + @DisplayName("Winning determined by lowest card when needed") public void winningWithLowestCard() { String lowest2 = "2S 5H 6S 8D 7H"; String lowest3 = "3S 4D 6D 8C 7S"; @@ -55,6 +61,7 @@ public void winningWithLowestCard() { @Disabled("Remove to run test") @Test + @DisplayName("One pair beats nothing") public void nothingVsOnePair() { String nothing = "4S 5H 6C 8D KH"; String pairOf4 = "2S 4H 6S 4D JH"; @@ -64,6 +71,7 @@ public void nothingVsOnePair() { @Disabled("Remove to run test") @Test + @DisplayName("Compare two pairs correctly") public void twoPairs() { String pairOf2 = "4S 2H 6S 2D JH"; String pairOf4 = "2S 4H 6C 4D JD"; @@ -73,6 +81,7 @@ public void twoPairs() { @Disabled("Remove to run test") @Test + @DisplayName("Same pair compare by kickers") public void samePair() { String pairOf4Lower = "4H 4S AH JC 3D"; String pairOf4Higher = "4C 4D AS 5D 6C"; @@ -82,6 +91,7 @@ public void samePair() { @Disabled("Remove to run test") @Test + @DisplayName("Double pair beats single pair") public void onePairVsDoublePair() { String pairOf8 = "2S 8H 6S 8D JH"; String doublePair = "4S 5H 4C 8C 5C"; @@ -91,6 +101,7 @@ public void onePairVsDoublePair() { @Disabled("Remove to run test") @Test + @DisplayName("Compare two double pairs") public void twoDoublePairs() { String doublePair2And8 = "2S 8H 2D 8D 3H"; String doublePair4And5 = "4S 5H 4C 8S 5D"; @@ -100,6 +111,7 @@ public void twoDoublePairs() { @Disabled("Remove to run test") @Test + @DisplayName("Highest pair compared when same pair values") public void sameHighestPair() { String doublePair2AndQ = "2S QS 2C QD JH"; String doublePairJAndQ = "JD QH JS 8D QC"; @@ -109,6 +121,7 @@ public void sameHighestPair() { @Disabled("Remove to run test") @Test + @DisplayName("Identically ranked pairs resolved by kicker") public void identicallyRankedPairs() { String kicker8 = "JD QH JS 8D QC"; String kicker2 = "JS QS JC 2D QD"; @@ -118,6 +131,7 @@ public void identicallyRankedPairs() { @Disabled("Remove to run test") @Test + @DisplayName("Two pairs summing to same value compared correctly") public void twoPairsAddingToSameValue() { String doublePair6And3 = "6S 6H 3S 3H AS"; String doublePair7And2 = "7H 7S 2H 2S AC"; @@ -127,6 +141,7 @@ public void twoPairsAddingToSameValue() { @Disabled("Remove to run test") @Test + @DisplayName("Ranked by largest pair value first") public void rankedByLargestPair() { String doublePairs5And4 = "5C 2S 5S 4H 4C"; String doublePairs6And2 = "6S 2S 6H 7C 2C"; @@ -136,6 +151,7 @@ public void rankedByLargestPair() { @Disabled("Remove to run test") @Test + @DisplayName("Three-of-a-kind beats two pairs") public void doublePairVsThree() { String doublePair2And8 = "2S 8H 2H 8D JH"; String threeOf4 = "4S 5H 4C 8S 4H"; @@ -145,6 +161,7 @@ public void doublePairVsThree() { @Disabled("Remove to run test") @Test + @DisplayName("Compare two three-of-a-kinds") public void twoThrees() { String threeOf2 = "2S 2H 2C 8D JH"; String threeOf1 = "4S AH AS 8C AD"; @@ -154,6 +171,7 @@ public void twoThrees() { @Disabled("Remove to run test") @Test + @DisplayName("Three-of-a-kind tie broken by remaining card") public void sameThreesMultipleDecks() { String remainingCard7 = "5S AH AS 7C AD"; String remainingCard8 = "4S AH AS 8C AD"; @@ -163,6 +181,7 @@ public void sameThreesMultipleDecks() { @Disabled("Remove to run test") @Test + @DisplayName("Straight beats three-of-a-kind") public void threeVsStraight() { String threeOf4 = "4S 5H 4C 8D 4H"; String straight = "3S 4D 2S 6D 5C"; @@ -172,6 +191,7 @@ public void threeVsStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Ace can end a straight (high)") public void acesCanEndAStraight() { String hand = "4S 5H 4C 8D 4H"; String straightEndsA = "10D JH QS KD AC"; @@ -181,6 +201,7 @@ public void acesCanEndAStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Ace can start a straight (low)") public void acesCanStartAStraight() { String hand = "4S 5H 4C 8D 4H"; String straightStartA = "4D AH 3S 2D 5C"; @@ -190,6 +211,7 @@ public void acesCanStartAStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Ace cannot be in the middle of a straight") public void acesCannotBeInMiddleOfStraight() { String hand = "2C 3D 7H 5H 2S"; String straightMiddleA = "QS KH AC 2D 3S"; @@ -199,6 +221,7 @@ public void acesCannotBeInMiddleOfStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Two straights compared by highest card") public void twoStraights() { String straightTo8 = "4S 6C 7S 8D 5H"; String straightTo9 = "5S 7H 8S 9D 6H"; @@ -208,6 +231,7 @@ public void twoStraights() { @Disabled("Remove to run test") @Test + @DisplayName("Lowest straight starts with Ace low") public void theLowestStraightStartsWithAce() { String straight = "2H 3C 4D 5D 6H"; String straightStartA = "4S AH 3S 2D 5H"; @@ -217,6 +241,7 @@ public void theLowestStraightStartsWithAce() { @Disabled("Remove to run test") @Test + @DisplayName("Flush beats straight") public void straightVsFlush() { String straightTo8 = "4C 6H 7D 8D 5H"; String flushTo7 = "2S 4S 5S 6S 7S"; @@ -226,6 +251,7 @@ public void straightVsFlush() { @Disabled("Remove to run test") @Test + @DisplayName("Compare two flushes") public void twoFlushs() { String flushTo9 = "2H 7H 8H 9H 6H"; String flushTo7 = "3S 5S 6S 7S 8S"; @@ -235,6 +261,7 @@ public void twoFlushs() { @Disabled("Remove to run test") @Test + @DisplayName("Full house beats flush") public void flushVsFull() { String flushTo8 = "3H 6H 7H 8H 5H"; String full = "4S 5H 4C 5D 4H"; @@ -244,6 +271,7 @@ public void flushVsFull() { @Disabled("Remove to run test") @Test + @DisplayName("Compare two full houses") public void twoFulls() { String fullOf4By9 = "4H 4S 4D 9S 9D"; String fullOf5By8 = "5H 5S 5D 8S 8D"; @@ -253,6 +281,7 @@ public void twoFulls() { @Disabled("Remove to run test") @Test + @DisplayName("Full houses with same triplet compared by pair") public void twoFullssameThripletMultipleDecks() { String fullOf5By9 = "5H 5S 5D 9S 9D"; String fullOf5By8 = "5H 5S 5D 8S 8D"; @@ -262,6 +291,7 @@ public void twoFullssameThripletMultipleDecks() { @Disabled("Remove to run test") @Test + @DisplayName("Four-of-a-kind beats full house") public void fullVsSquare() { String full = "4S 5H 4D 5D 4H"; String squareOf3 = "3S 3H 2S 3D 3C"; @@ -271,6 +301,7 @@ public void fullVsSquare() { @Disabled("Remove to run test") @Test + @DisplayName("Compare two four-of-a-kinds") public void twoSquares() { String squareOf2 = "2S 2H 2C 8D 2D"; String squareOf5 = "4S 5H 5S 5D 5C"; @@ -280,6 +311,7 @@ public void twoSquares() { @Disabled("Remove to run test") @Test + @DisplayName("Four-of-a-kind tie broken by kicker") public void sameSquaresMultipleDecks() { String kicker2 = "3S 3H 2S 3D 3C"; String kicker4 = "3S 3H 4S 3D 3C"; @@ -289,6 +321,7 @@ public void sameSquaresMultipleDecks() { @Disabled("Remove to run test") @Test + @DisplayName("Straight flush beats four-of-a-kind") public void squareVsStraightFlush() { String squareOf5 = "4S 5H 5S 5D 5C"; String straightFlushTo9 = "7S 8S 9S 6S 10S"; @@ -298,6 +331,7 @@ public void squareVsStraightFlush() { @Disabled("Remove to run test") @Test + @DisplayName("Straight flush ending with Ace is highest") public void acesEndingStraightFlush() { String hand = "KC AH AS AD AC"; String straightFlushEndingWithA = "10C JC QC KC AC"; @@ -307,6 +341,7 @@ public void acesEndingStraightFlush() { @Disabled("Remove to run test") @Test + @DisplayName("Straight flush starting with Ace (low) is allowed") public void acesStartingStraightFlush() { String straightFlushStartingWithA = "4H AH 3H 2H 5H"; String hand = "KS AH AS AD AC"; @@ -316,6 +351,7 @@ public void acesStartingStraightFlush() { @Disabled("Remove to run test") @Test + @DisplayName("Ace cannot be in middle of straight flush") public void acesCannotBeInMiddleOfStraightFlush() { String straightFlushWithAInMiddle = "QH KH AH 2H 3H"; String hand = "2C AC QC 10C KC"; @@ -325,6 +361,7 @@ public void acesCannotBeInMiddleOfStraightFlush() { @Disabled("Remove to run test") @Test + @DisplayName("Compare two straight flushes by highest card") public void twoStraightFlushes() { String straightFlushTo8 = "4H 6H 7H 8H 5H"; String straightFlushTo9 = "5S 7S 8S 9S 6S"; @@ -334,6 +371,7 @@ public void twoStraightFlushes() { @Disabled("Remove to run test") @Test + @DisplayName("Lowest straight flush to 5 is ranked lowest") public void straightFlushTo5IsTheLowestScoring() { String straightFlushTo6 = "2H 3H 4H 5H 6H"; String straightFlushTo5 = "4D AD 3D 2D 5D"; From 240a2d22e71424865ce0ebd5e7e0866ba7d3c2c5 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:14:42 +0530 Subject: [PATCH 05/22] Added DisplayName to PiecingItTogetherTest --- .../src/test/java/PiecingItTogetherTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exercises/practice/piecing-it-together/src/test/java/PiecingItTogetherTest.java b/exercises/practice/piecing-it-together/src/test/java/PiecingItTogetherTest.java index b07648c0a..dbd856080 100644 --- a/exercises/practice/piecing-it-together/src/test/java/PiecingItTogetherTest.java +++ b/exercises/practice/piecing-it-together/src/test/java/PiecingItTogetherTest.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; @@ -8,6 +9,7 @@ public class PiecingItTogetherTest { private static final double DOUBLE_EQUALITY_TOLERANCE = 1e-9; @Test + @DisplayName("Complete information from pieces and aspect ratio is calculated") public void test1000PiecesWithAspectRatio() { JigsawInfo input = new JigsawInfo.Builder() .pieces(1000) @@ -30,6 +32,7 @@ public void test1000PiecesWithAspectRatio() { @Disabled("Remove to run test") @Test + @DisplayName("Square puzzle specified by rows yields expected info") public void testSquarePuzzleWith32Rows() { JigsawInfo input = new JigsawInfo.Builder() .rows(32) @@ -52,6 +55,7 @@ public void testSquarePuzzleWith32Rows() { @Disabled("Remove to run test") @Test + @DisplayName("Inside count and aspect ratio determine full info") public void testInsideAndAspectRatioOnly() { JigsawInfo input = new JigsawInfo.Builder() .inside(324) @@ -74,6 +78,7 @@ public void testInsideAndAspectRatioOnly() { @Disabled("Remove to run test") @Test + @DisplayName("Landscape puzzle with given rows and aspect returns expected info") public void testLandscape1500WithRowsAndAspect() { JigsawInfo input = new JigsawInfo.Builder() .rows(30) @@ -96,6 +101,7 @@ public void testLandscape1500WithRowsAndAspect() { @Disabled("Remove to run test") @Test + @DisplayName("Portrait puzzle with pieces and border returns expected info") public void test300PiecesPortraitWithBorder() { JigsawInfo input = new JigsawInfo.Builder() .pieces(300) @@ -119,6 +125,7 @@ public void test300PiecesPortraitWithBorder() { @Disabled("Remove to run test") @Test + @DisplayName("Insufficient data throws IllegalArgumentException") public void testInsufficientData() { JigsawInfo input = new JigsawInfo.Builder() .pieces(1500) @@ -132,6 +139,7 @@ public void testInsufficientData() { @Disabled("Remove to run test") @Test + @DisplayName("Contradictory data throws IllegalArgumentException") public void testContradictoryData() { JigsawInfo input = new JigsawInfo.Builder() .rows(100) From b78d58c73781fd023f2dd4344bd5a0f0933f0a6a Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:15:07 +0530 Subject: [PATCH 06/22] Added DisplayName to PhoneNumberTest --- .../src/test/java/PhoneNumberTest.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/exercises/practice/phone-number/src/test/java/PhoneNumberTest.java b/exercises/practice/phone-number/src/test/java/PhoneNumberTest.java index bfd7c6212..4971bc472 100644 --- a/exercises/practice/phone-number/src/test/java/PhoneNumberTest.java +++ b/exercises/practice/phone-number/src/test/java/PhoneNumberTest.java @@ -1,12 +1,14 @@ -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - 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; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + public class PhoneNumberTest { @Test + @DisplayName("Cleans common formatted number to digits only") public void cleansTheNumber() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("(223) 456-7890").getNumber(); @@ -16,6 +18,7 @@ public void cleansTheNumber() { @Disabled("Remove to run test") @Test + @DisplayName("Cleans numbers with dots to digits only") public void cleansNumbersWithDots() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("223.456.7890").getNumber(); @@ -26,6 +29,7 @@ public void cleansNumbersWithDots() { @Disabled("Remove to run test") @Test + @DisplayName("Cleans numbers with multiple spaces") public void cleansNumbersWithMultipleSpaces() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("223 456 7890 ").getNumber(); @@ -35,6 +39,7 @@ public void cleansNumbersWithMultipleSpaces() { @Disabled("Remove to run test") @Test + @DisplayName("Nine digit numbers are invalid") public void invalidWhen9Digits() { assertThatExceptionOfType(IllegalArgumentException.class) @@ -44,6 +49,7 @@ public void invalidWhen9Digits() { @Disabled("Remove to run test") @Test + @DisplayName("Eleven digits not starting with 1 are invalid") public void invalidWhen11DigitsDoesNotStartWith1() { assertThatExceptionOfType(IllegalArgumentException.class) @@ -53,6 +59,7 @@ public void invalidWhen11DigitsDoesNotStartWith1() { @Disabled("Remove to run test") @Test + @DisplayName("Eleven digits starting with 1 are accepted and trimmed") public void validWhen11DigitsAndStartingWith1() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("12234567890").getNumber(); @@ -62,6 +69,7 @@ public void validWhen11DigitsAndStartingWith1() { @Disabled("Remove to run test") @Test + @DisplayName("Valid 11-digit number with punctuation is accepted") public void validWhen11DigitsAndStartingWith1EvenWithPunctuation() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("+1 (223) 456-7890").getNumber(); @@ -71,6 +79,7 @@ public void validWhen11DigitsAndStartingWith1EvenWithPunctuation() { @Disabled("Remove to run test") @Test + @DisplayName("More than 11 digits is invalid") public void invalidWhenMoreThan11Digits() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("321234567890")) @@ -79,6 +88,7 @@ public void invalidWhenMoreThan11Digits() { @Disabled("Remove to run test") @Test + @DisplayName("Letters in number are not permitted") public void invalidWithLetters() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("523-abc-7890")) @@ -87,6 +97,7 @@ public void invalidWithLetters() { @Disabled("Remove to run test") @Test + @DisplayName("Unsupported punctuations are not permitted") public void invalidWithPunctuations() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("523-@:!-7890")) @@ -95,6 +106,7 @@ public void invalidWithPunctuations() { @Disabled("Remove to run test") @Test + @DisplayName("Area code starting with 0 is invalid") public void invalidIfAreaCodeStartsWith0() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("(023) 456-7890")) @@ -103,6 +115,7 @@ public void invalidIfAreaCodeStartsWith0() { @Disabled("Remove to run test") @Test + @DisplayName("Area code starting with 1 is invalid") public void invalidIfAreaCodeStartsWith1() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("(123) 456-7890")) @@ -111,6 +124,7 @@ public void invalidIfAreaCodeStartsWith1() { @Disabled("Remove to run test") @Test + @DisplayName("Exchange code starting with 0 is invalid") public void invalidIfExchangeCodeStartsWith0() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("(223) 056-7890")) @@ -119,6 +133,7 @@ public void invalidIfExchangeCodeStartsWith0() { @Disabled("Remove to run test") @Test + @DisplayName("Exchange code starting with 1 is invalid") public void invalidIfExchangeCodeStartsWith1() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("(223) 156-7890")) @@ -127,6 +142,7 @@ public void invalidIfExchangeCodeStartsWith1() { @Disabled("Remove to run test") @Test + @DisplayName("Area code starting with 0 invalid on valid 11-digit number") public void invalidIfAreaCodeStartsWith0OnValid11DigitNumber() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("1 (023) 456-7890")) @@ -135,6 +151,7 @@ public void invalidIfAreaCodeStartsWith0OnValid11DigitNumber() { @Disabled("Remove to run test") @Test + @DisplayName("Area code starting with 1 invalid on valid 11-digit number") public void invalidIfAreaCodeStartsWith1OnValid11DigitNumber() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("1 (123) 456-7890")) @@ -143,6 +160,7 @@ public void invalidIfAreaCodeStartsWith1OnValid11DigitNumber() { @Disabled("Remove to run test") @Test + @DisplayName("Exchange code starting with 0 invalid on valid 11-digit number") public void invalidIfExchangeCodeStartsWith0OnValid11DigitNumber() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("1 (223) 056-7890")) @@ -151,6 +169,7 @@ public void invalidIfExchangeCodeStartsWith0OnValid11DigitNumber() { @Disabled("Remove to run test") @Test + @DisplayName("Exchange code starting with 1 invalid on valid 11-digit number") public void invalidIfExchangeCodeStartsWith1OnValid11DigitNumber() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("1 (223) 156-7890")) From 89477902a87d6678ac8696eb8653bae1a4fece57 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:16:36 +0530 Subject: [PATCH 07/22] Added DisplayName to NaturalNumberTest --- .../src/test/java/NaturalNumberTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/exercises/practice/perfect-numbers/src/test/java/NaturalNumberTest.java b/exercises/practice/perfect-numbers/src/test/java/NaturalNumberTest.java index b7387c4b1..e4abc9aad 100644 --- a/exercises/practice/perfect-numbers/src/test/java/NaturalNumberTest.java +++ b/exercises/practice/perfect-numbers/src/test/java/NaturalNumberTest.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; @@ -7,66 +8,77 @@ public class NaturalNumberTest { @Test + @DisplayName("Small perfect number (6) is classified as PERFECT") public void testSmallPerfectNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(6).getClassification()).isEqualTo(Classification.PERFECT); } @Disabled("Remove to run test") @Test + @DisplayName("Medium perfect number (28) is classified as PERFECT") public void testMediumPerfectNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(28).getClassification()).isEqualTo(Classification.PERFECT); } @Disabled("Remove to run test") @Test + @DisplayName("Large perfect number is classified as PERFECT") public void testLargePerfectNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(33550336).getClassification()).isEqualTo(Classification.PERFECT); } @Disabled("Remove to run test") @Test + @DisplayName("Small abundant number is classified as ABUNDANT") public void testSmallAbundantNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(12).getClassification()).isEqualTo(Classification.ABUNDANT); } @Disabled("Remove to run test") @Test + @DisplayName("Medium abundant number is classified as ABUNDANT") public void testMediumAbundantNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(30).getClassification()).isEqualTo(Classification.ABUNDANT); } @Disabled("Remove to run test") @Test + @DisplayName("Large abundant number is classified as ABUNDANT") public void testLargeAbundantNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(33550335).getClassification()).isEqualTo(Classification.ABUNDANT); } @Disabled("Remove to run test") @Test + @DisplayName("Smallest prime number (2) is classified as DEFICIENT") public void testSmallestPrimeDeficientNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(2).getClassification()).isEqualTo(Classification.DEFICIENT); } @Disabled("Remove to run test") @Test + @DisplayName("Smallest non-prime deficient number (4) is classified as DEFICIENT") public void testSmallestNonPrimeDeficientNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(4).getClassification()).isEqualTo(Classification.DEFICIENT); } @Disabled("Remove to run test") @Test + @DisplayName("Medium deficient number is classified as DEFICIENT") public void testMediumDeficientNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(32).getClassification()).isEqualTo(Classification.DEFICIENT); } @Disabled("Remove to run test") @Test + @DisplayName("Large deficient number is classified as DEFICIENT") public void testLargeDeficientNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(33550337).getClassification()).isEqualTo(Classification.DEFICIENT); } @Disabled("Remove to run test") @Test + @DisplayName("One is classified as DEFICIENT (no proper divisors)") /* * The number 1 has no proper divisors (https://en.wikipedia.org/wiki/Divisor#Further_notions_and_facts), and the * additive identity is 0, so the aliquot sum of 1 should be 0. Hence 1 should be classified as deficient. @@ -77,6 +89,7 @@ public void testThatOneIsCorrectlyClassifiedAsDeficient() { @Disabled("Remove to run test") @Test + @DisplayName("Zero is rejected as not a natural number") public void testThatNonNegativeIntegerIsRejected() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new NaturalNumber(0)) @@ -85,6 +98,7 @@ public void testThatNonNegativeIntegerIsRejected() { @Disabled("Remove to run test") @Test + @DisplayName("Negative integers are rejected") public void testThatNegativeIntegerIsRejected() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new NaturalNumber(-1)) From d742b56d9fef28cbe1d8dae99ff9c0d09720afa6 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:16:55 +0530 Subject: [PATCH 08/22] Added DisplayName to PascalsTriangleGeneratorTest --- .../src/test/java/PascalsTriangleGeneratorTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/exercises/practice/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java b/exercises/practice/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java index c72c2dc07..fa434b4ad 100644 --- a/exercises/practice/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java +++ b/exercises/practice/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java @@ -1,5 +1,6 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.DisplayName; import static org.assertj.core.api.Assertions.assertThat; @@ -9,6 +10,7 @@ public class PascalsTriangleGeneratorTest { new PascalsTriangleGenerator(); @Test + @DisplayName("Zero rows produces empty triangle") public void testTriangleWithZeroRows() { int[][] expectedOutput = new int[][]{}; @@ -17,6 +19,7 @@ public void testTriangleWithZeroRows() { @Disabled("Remove to run test") @Test + @DisplayName("One row produces single element row") public void testTriangleWithOneRow() { int[][] expectedOutput = new int[][]{ {1} @@ -27,6 +30,7 @@ public void testTriangleWithOneRow() { @Disabled("Remove to run test") @Test + @DisplayName("Two rows produce proper Pascal triangle") public void testTriangleWithTwoRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -38,6 +42,7 @@ public void testTriangleWithTwoRows() { @Disabled("Remove to run test") @Test + @DisplayName("Three rows produce proper Pascal triangle") public void testTriangleWithThreeRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -50,6 +55,7 @@ public void testTriangleWithThreeRows() { @Disabled("Remove to run test") @Test + @DisplayName("Four rows produce proper Pascal triangle") public void testTriangleWithFourRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -63,6 +69,7 @@ public void testTriangleWithFourRows() { @Disabled("Remove to run test") @Test + @DisplayName("Five rows produce proper Pascal triangle") public void testTriangleWithFiveRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -77,6 +84,7 @@ public void testTriangleWithFiveRows() { @Disabled("Remove to run test") @Test + @DisplayName("Six rows produce proper Pascal triangle") public void testTriangleWithSixRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -92,6 +100,7 @@ public void testTriangleWithSixRows() { @Disabled("Remove to run test") @Test + @DisplayName("Ten rows produce correct Pascal triangle up to 10") public void testTriangleWithTenRows() { int[][] expectedOutput = new int[][]{ {1}, From 0911db638e8c9ffc79a96a205e870004f368648f Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:17:24 +0530 Subject: [PATCH 09/22] Added DisplayName to ParallelLetterFrequencyTest --- .../src/test/java/ParallelLetterFrequencyTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java b/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java index 1f3e83ba3..90d4e1527 100644 --- a/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java +++ b/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java @@ -1,4 +1,5 @@ import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.Arrays; @@ -205,6 +206,7 @@ public class ParallelLetterFrequencyTest { "- from the days of the Flood to the Schleswig-Holstein period."; @Test + @DisplayName("No input texts yields empty frequency map") public void testNoTexts() { String[] input = {}; Map expectedOutput = new HashMap<>(); @@ -215,6 +217,7 @@ public void testNoTexts() { @Disabled("Remove to run test") @Test + @DisplayName("Single text with a single letter counted") public void testOneTextWithOneLetter() { String[] input = { "a" }; Map expectedOutput = new HashMap<>() { @@ -229,6 +232,7 @@ public void testOneTextWithOneLetter() { @Disabled("Remove to run test") @Test + @DisplayName("Single text with repeated letters counted correctly") public void testOneTextWithMultipleLetters() { String[] input = { "bbcccd" }; Map expectedOutput = new HashMap<>() { @@ -245,6 +249,7 @@ public void testOneTextWithMultipleLetters() { @Disabled("Remove to run test") @Test + @DisplayName("Two texts each with one distinct letter counted") public void testTwoTextsWithOneLetter() { String[] input = { "e", "f" }; Map expectedOutput = new HashMap<>() { @@ -260,6 +265,7 @@ public void testTwoTextsWithOneLetter() { @Disabled("Remove to run test") @Test + @DisplayName("Two texts with overlapping letters aggregated correctly") public void testTwoTextsWithMultipleLetters() { String[] input = { "ggh", "hhi" }; Map expectedOutput = new HashMap<>() { @@ -276,6 +282,7 @@ public void testTwoTextsWithMultipleLetters() { @Disabled("Remove to run test") @Test + @DisplayName("Letter counting is case-insensitive") public void testIgnoreLetterCasing() { String[] input = { "m", "M" }; Map expectedOutput = new HashMap<>() { @@ -290,6 +297,7 @@ public void testIgnoreLetterCasing() { @Disabled("Remove to run test") @Test + @DisplayName("Whitespace-only inputs are ignored") public void testIgnoreWhitespace() { String[] input = { " ", "\t", "\r\n" }; Map expectedOutput = new HashMap<>(); @@ -300,6 +308,7 @@ public void testIgnoreWhitespace() { @Disabled("Remove to run test") @Test + @DisplayName("Punctuation-only inputs are ignored") public void testIgnorePunctuation() { String[] input = { "!", "?", ";", ",", "." }; Map expectedOutput = new HashMap<>(); @@ -310,6 +319,7 @@ public void testIgnorePunctuation() { @Disabled("Remove to run test") @Test + @DisplayName("Numeric characters are ignored") public void testIgnoreNumbers() { String[] input = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; Map expectedOutput = new HashMap<>(); @@ -320,6 +330,7 @@ public void testIgnoreNumbers() { @Disabled("Remove to run test") @Test + @DisplayName("Unicode letters are counted correctly") public void testUnicodeLetters() { String[] input = { "本", "φ", "ほ", "ø" }; Map expectedOutput = new HashMap<>() { @@ -337,6 +348,7 @@ public void testUnicodeLetters() { @Disabled("Remove to run test") @Test + @DisplayName("Complex mixture of casing, punctuation and whitespace counted correctly") public void testCombinationOfLowerAndUppercaseLettersPunctuationAndWhiteSpace() { String[] input = {calculateFrequencies}; Map expectedOutput = new HashMap<>() { @@ -372,6 +384,7 @@ public void testCombinationOfLowerAndUppercaseLettersPunctuationAndWhiteSpace() @Disabled("Remove to run test") @Test + @DisplayName("Many small identical texts aggregate correctly") public void testManySmallTexts() { String[] input = new String[50]; Arrays.fill(input, "abbccc"); @@ -389,6 +402,7 @@ public void testManySmallTexts() { @Disabled("Remove to run test") @Test + @DisplayName("Large texts are counted correctly") public void testLargeTexts() { String[] input = { largeTexts1, largeTexts2, largeTexts3, largeTexts4 }; Map expectedOutput = new HashMap<>() { From 3263b85a75f273540e738e8a19e3d9aa34455cf6 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:18:04 +0530 Subject: [PATCH 10/22] Added DisplayName to MazeGeneratorTest --- .../mazy-mice/src/test/java/MazeGeneratorTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java b/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java index 24e5de663..ed2a3c89e 100644 --- a/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java +++ b/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java @@ -1,5 +1,6 @@ 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 java.util.Set; @@ -37,6 +38,7 @@ public void setup() { } @Test + @DisplayName("Generated maze has correct overall dimensions") public void theDimensionsOfTheMazeAreCorrect() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); var expectedWidth = RECTANGLE_COLUMNS * 2 + 1; @@ -49,6 +51,7 @@ public void theDimensionsOfTheMazeAreCorrect() { @Disabled("Remove to run test") @Test + @DisplayName("Maze contains only allowed characters") public void theMazeContainsOnlyValidCharacters() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); @@ -63,6 +66,7 @@ public void theMazeContainsOnlyValidCharacters() { @Disabled("Remove to run test") @Test + @DisplayName("Maze has a single entrance on the left side") public void theMazeHasOnlyOneEntranceOnTheLeftSide() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); int entranceCount = countEntrances(maze); @@ -74,6 +78,7 @@ public void theMazeHasOnlyOneEntranceOnTheLeftSide() { @Disabled("Remove to run test") @Test + @DisplayName("Maze has a single exit on the right side") public void theMazeHasSingleExitOnTheRightSideOfTheMaze() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); int exitCount = countExits(maze); @@ -85,6 +90,7 @@ public void theMazeHasSingleExitOnTheRightSideOfTheMaze() { @Disabled("Remove to run test") @Test + @DisplayName("Consecutive maze generations produce different mazes") public void aMazeIsDifferentEachTimeItIsGenerated() { var maze1 = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); var maze2 = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); @@ -96,6 +102,7 @@ public void aMazeIsDifferentEachTimeItIsGenerated() { @Disabled("Remove to run test") @Test + @DisplayName("Mazes generated with same seed are identical") public void twoMazesWithSameSeedShouldBeEqual() { var maze1 = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS, SEED_ONE); var maze2 = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS, SEED_ONE); @@ -107,6 +114,7 @@ public void twoMazesWithSameSeedShouldBeEqual() { @Disabled("Remove to run test") @Test + @DisplayName("Mazes generated with different seeds are different") public void twoMazesWithDifferentSeedsShouldNotBeEqual() { var maze1 = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS, SEED_ONE); var maze2 = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS, SEED_TWO); @@ -118,6 +126,7 @@ public void twoMazesWithDifferentSeedsShouldNotBeEqual() { @Disabled("Remove to run test") @Test + @DisplayName("Generated maze is perfect (single path, no isolated cells)") public void theMazeIsPerfect() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); @@ -127,6 +136,7 @@ public void theMazeIsPerfect() { @Disabled("Remove to run test") @Test + @DisplayName("Generated maze with seed is perfect (single path, no isolated cells)") public void theMazeIsPerfectWithSeed() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS, SEED_ONE); @@ -136,6 +146,7 @@ public void theMazeIsPerfectWithSeed() { @Disabled("Remove to run test") @Test + @DisplayName("Throws when rows less than minimum allowed") public void shouldThrowExceptionWhenRowsIsLessThanFive() { assertThatIllegalArgumentException() .isThrownBy(() -> sut.generatePerfectMaze(0, RECTANGLE_COLUMNS)); @@ -143,6 +154,7 @@ public void shouldThrowExceptionWhenRowsIsLessThanFive() { @Disabled("Remove to run test") @Test + @DisplayName("Throws when columns less than minimum allowed") public void shouldThrowExceptionWhenColumnsIsLessThanFive() { assertThatIllegalArgumentException() .isThrownBy(() -> sut.generatePerfectMaze(RECTANGLE_ROWS, 0)); @@ -150,6 +162,7 @@ public void shouldThrowExceptionWhenColumnsIsLessThanFive() { @Disabled("Remove to run test") @Test + @DisplayName("Throws when rows exceed maximum allowed") public void shouldThrowExceptionWhenRowsIsMoreThenHundred() { assertThatIllegalArgumentException() .isThrownBy(() -> sut.generatePerfectMaze(101, RECTANGLE_COLUMNS)); @@ -157,6 +170,7 @@ public void shouldThrowExceptionWhenRowsIsMoreThenHundred() { @Disabled("Remove to run test") @Test + @DisplayName("Throws when columns exceed maximum allowed") public void shouldThrowExceptionWhenColumnsIsMoreThenHundred() { assertThatIllegalArgumentException() .isThrownBy(() -> sut.generatePerfectMaze(RECTANGLE_ROWS, 101)); From b00d4610bc35cfe95af3a837fba887c819670900 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:18:56 +0530 Subject: [PATCH 11/22] Added DisplayName to ErrorHandlingTest --- .../src/test/java/ErrorHandlingTest.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/exercises/practice/error-handling/src/test/java/ErrorHandlingTest.java b/exercises/practice/error-handling/src/test/java/ErrorHandlingTest.java index c7864c7ad..f74efcb7b 100644 --- a/exercises/practice/error-handling/src/test/java/ErrorHandlingTest.java +++ b/exercises/practice/error-handling/src/test/java/ErrorHandlingTest.java @@ -1,16 +1,18 @@ -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.Optional; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + public class ErrorHandlingTest { private ErrorHandling errorHandling = new ErrorHandling(); @Test + @DisplayName("Throws a general exception when requested") public void testThrowIllegalArgumentException() { assertThatExceptionOfType(Exception.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingIllegalArgumentException()); @@ -18,6 +20,7 @@ public void testThrowIllegalArgumentException() { @Disabled("Remove to run test") @Test + @DisplayName("Throws IllegalArgumentException with provided detail message") public void testThrowIllegalArgumentExceptionWithDetailMessage() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingIllegalArgumentExceptionWithDetailMessage( @@ -27,6 +30,7 @@ public void testThrowIllegalArgumentExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test + @DisplayName("Throws a checked exception (not a RuntimeException)") public void testThrowAnyCheckedException() { assertThatExceptionOfType(Exception.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingAnyCheckedException()) @@ -35,6 +39,7 @@ public void testThrowAnyCheckedException() { @Disabled("Remove to run test") @Test + @DisplayName("Throws a checked exception with the provided detail message") public void testThrowAnyCheckedExceptionWithDetailMessage() { assertThatExceptionOfType(Exception.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingAnyCheckedExceptionWithDetailMessage( @@ -45,6 +50,7 @@ public void testThrowAnyCheckedExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test + @DisplayName("Throws an unchecked RuntimeException when requested") public void testThrowAnyUncheckedException() { assertThatExceptionOfType(RuntimeException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingAnyUncheckedException()); @@ -52,6 +58,7 @@ public void testThrowAnyUncheckedException() { @Disabled("Remove to run test") @Test + @DisplayName("Throws an unchecked RuntimeException with provided detail message") public void testThrowAnyUncheckedExceptionWithDetailMessage() { assertThatExceptionOfType(RuntimeException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingAnyUncheckedExceptionWithDetailMessage( @@ -61,6 +68,7 @@ public void testThrowAnyUncheckedExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test + @DisplayName("Throws a custom checked exception") public void testThrowCustomCheckedException() { assertThatExceptionOfType(CustomCheckedException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingCustomCheckedException()); @@ -68,6 +76,7 @@ public void testThrowCustomCheckedException() { @Disabled("Remove to run test") @Test + @DisplayName("Throws a custom checked exception with provided message") public void testThrowCustomCheckedExceptionWithDetailMessage() { assertThatExceptionOfType(CustomCheckedException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingCustomCheckedExceptionWithDetailMessage( @@ -77,6 +86,7 @@ public void testThrowCustomCheckedExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test + @DisplayName("Throws a custom unchecked exception") public void testThrowCustomUncheckedException() { assertThatExceptionOfType(CustomUncheckedException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingCustomUncheckedException()); @@ -84,6 +94,7 @@ public void testThrowCustomUncheckedException() { @Disabled("Remove to run test") @Test + @DisplayName("Throws a custom unchecked exception with provided message") public void testThrowCustomUncheckedExceptionWithDetailMessage() { assertThatExceptionOfType(CustomUncheckedException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingCustomUncheckedExceptionWithDetailMessage( @@ -93,6 +104,7 @@ public void testThrowCustomUncheckedExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test + @DisplayName("Returns Optional for valid input and empty Optional for invalid input") public void testReturnOptionalInstance() { Optional successfulResult = errorHandling.handleErrorByReturningOptionalInstance("1"); assertThat(successfulResult).isPresent().hasValue(1); From 4b9f11a1132f914e77813ee1d03465307069c663 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:19:15 +0530 Subject: [PATCH 12/22] Added DisplayName to BracketCheckerTest --- .../src/test/java/BracketCheckerTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/exercises/practice/matching-brackets/src/test/java/BracketCheckerTest.java b/exercises/practice/matching-brackets/src/test/java/BracketCheckerTest.java index f1a5b5e7e..9539985cf 100644 --- a/exercises/practice/matching-brackets/src/test/java/BracketCheckerTest.java +++ b/exercises/practice/matching-brackets/src/test/java/BracketCheckerTest.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; @@ -6,6 +7,7 @@ public class BracketCheckerTest { @Test + @DisplayName("Paired square brackets are matched and valid") public void testPairedSquareBrackets() { BracketChecker bracketChecker = new BracketChecker("[]"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -13,6 +15,7 @@ public void testPairedSquareBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Empty string contains no brackets and is valid") public void testEmptyString() { BracketChecker bracketChecker = new BracketChecker(""); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -20,6 +23,7 @@ public void testEmptyString() { @Disabled("Remove to run test") @Test + @DisplayName("Unpaired brackets are invalid") public void testUnpairedBrackets() { BracketChecker bracketChecker = new BracketChecker("[["); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -27,6 +31,7 @@ public void testUnpairedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Wrong ordered brackets are invalid") public void testWrongOrderedBrackets() { BracketChecker bracketChecker = new BracketChecker("}{"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -34,6 +39,7 @@ public void testWrongOrderedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Wrong closing bracket type is invalid") public void testWrongClosingBracket() { BracketChecker bracketChecker = new BracketChecker("{]"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -41,6 +47,7 @@ public void testWrongClosingBracket() { @Disabled("Remove to run test") @Test + @DisplayName("Paired brackets with whitespace are valid") public void testPairedWithWhitespace() { BracketChecker bracketChecker = new BracketChecker("{ }"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -48,6 +55,7 @@ public void testPairedWithWhitespace() { @Disabled("Remove to run test") @Test + @DisplayName("Partially paired brackets are invalid") public void testPartiallyPairedBrackets() { BracketChecker bracketChecker = new BracketChecker("{[])"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -55,6 +63,7 @@ public void testPartiallyPairedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Simple nested brackets are valid") public void testSimpleNestedBrackets() { BracketChecker bracketChecker = new BracketChecker("{[]}"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -62,6 +71,7 @@ public void testSimpleNestedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Several paired brackets in sequence are valid") public void testSeveralPairedBrackets() { BracketChecker bracketChecker = new BracketChecker("{}[]"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -69,6 +79,7 @@ public void testSeveralPairedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Paired and nested complex brackets are valid") public void testPairedAndNestedBrackets() { BracketChecker bracketChecker = new BracketChecker("([{}({}[])])"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -76,6 +87,7 @@ public void testPairedAndNestedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Unopened closing bracket is invalid") public void testUnopenedClosingBracket() { BracketChecker bracketChecker = new BracketChecker("{[)][]}"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -83,6 +95,7 @@ public void testUnopenedClosingBracket() { @Disabled("Remove to run test") @Test + @DisplayName("Unpaired and nested brackets are invalid") public void testUnpairedAndNestedBrackets() { BracketChecker bracketChecker = new BracketChecker("([{])"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -90,6 +103,7 @@ public void testUnpairedAndNestedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Paired but wrongly nested brackets are invalid") public void testPairedAndWrongNestedBrackets() { BracketChecker bracketChecker = new BracketChecker("[({]})"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -97,6 +111,7 @@ public void testPairedAndWrongNestedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Innermost correct but overall wrong nesting is invalid") public void testPairedAndWrongNestedBracketsButInnermostAreCorrect() { BracketChecker bracketChecker = new BracketChecker("[({}])"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -104,6 +119,7 @@ public void testPairedAndWrongNestedBracketsButInnermostAreCorrect() { @Disabled("Remove to run test") @Test + @DisplayName("Paired and incomplete brackets are invalid") public void testPairedAndIncompleteBrackets() { BracketChecker bracketChecker = new BracketChecker("{}["); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -111,6 +127,7 @@ public void testPairedAndIncompleteBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Too many closing brackets are invalid") public void testTooManyClosingBrackets() { BracketChecker bracketChecker = new BracketChecker("[]]"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -118,6 +135,7 @@ public void testTooManyClosingBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Early unexpected closing bracket is invalid") public void testEarlyUnexpectedBrackets() { BracketChecker bracketChecker = new BracketChecker(")()"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -125,6 +143,7 @@ public void testEarlyUnexpectedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Early mismatched brackets are invalid") public void testEarlyMismatchedBrackets() { BracketChecker bracketChecker = new BracketChecker("{)()"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -132,6 +151,7 @@ public void testEarlyMismatchedBrackets() { @Disabled("Remove to run test") @Test + @DisplayName("Math expression with balanced parentheses is valid") public void testMathExpression() { BracketChecker bracketChecker = new BracketChecker("(((185 + 223.85) * 15) - 543)/2"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -139,6 +159,7 @@ public void testMathExpression() { @Disabled("Remove to run test") @Test + @DisplayName("Complex LaTeX expression with matched brackets is valid") public void testComplexLatexExpression() { BracketChecker bracketChecker = new BracketChecker( "\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)"); From caa95607bbdc65fdc92e724191df5a1f860f5233 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:19:31 +0530 Subject: [PATCH 13/22] Added DisplayName to HangmanTest --- .../practice/hangman/src/test/java/HangmanTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/exercises/practice/hangman/src/test/java/HangmanTest.java b/exercises/practice/hangman/src/test/java/HangmanTest.java index df60dbee9..a2215defe 100644 --- a/exercises/practice/hangman/src/test/java/HangmanTest.java +++ b/exercises/practice/hangman/src/test/java/HangmanTest.java @@ -3,6 +3,7 @@ import io.reactivex.disposables.Disposable; 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 java.util.ArrayList; @@ -22,6 +23,7 @@ public void init() { } @Test + @DisplayName("Initial game state is set correctly for a new word") public void initialization() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -39,6 +41,7 @@ public void initialization() { @Disabled("Remove to run test") @Test + @DisplayName("First correct guess updates discovered and guess lists") public void firstGuess() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -54,6 +57,7 @@ public void firstGuess() { @Disabled("Remove to run test") @Test + @DisplayName("First incorrect guess registers a miss and adds a part") public void firstMiss() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -69,6 +73,7 @@ public void firstMiss() { @Disabled("Remove to run test") @Test + @DisplayName("Game in progress accumulates guesses, misses and parts correctly") public void gameInProgress() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -84,6 +89,7 @@ public void gameInProgress() { @Disabled("Remove to run test") @Test + @DisplayName("Winning the game reveals full word and marks WIN status") public void wonGame() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -97,6 +103,7 @@ public void wonGame() { @Disabled("Remove to run test") @Test + @DisplayName("Losing the game results in LOSS status and all parts present") public void lostGame() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -118,6 +125,7 @@ public void lostGame() { @Disabled("Remove to run test") @Test + @DisplayName("Handles consecutive games correctly with ordered emissions") public void consecutiveGames() { // This test setup is more complex because we have to order the emission of values in the // different observers. @@ -189,6 +197,7 @@ Observable createLetterObservable(ObservableEmitter[] emitters, Runnable emit) { @Disabled("Remove to run test") @Test + @DisplayName("Cannot play the same correct guess twice") public void cannotPlayAGuessTwice() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -201,6 +210,7 @@ public void cannotPlayAGuessTwice() { @Disabled("Remove to run test") @Test + @DisplayName("Cannot play the same miss twice") public void cannotPlayAMissTwice() { Observable result = hangman.play( Observable.fromArray("secret"), From d96f651abcba41f56720a0c140cb668f94025cdd Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Tue, 18 Nov 2025 00:19:57 +0530 Subject: [PATCH 14/22] Added DisplayName to MarkdownTest --- .../markdown/src/test/java/MarkdownTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/exercises/practice/markdown/src/test/java/MarkdownTest.java b/exercises/practice/markdown/src/test/java/MarkdownTest.java index 10f0823f2..e4f51ead9 100644 --- a/exercises/practice/markdown/src/test/java/MarkdownTest.java +++ b/exercises/practice/markdown/src/test/java/MarkdownTest.java @@ -1,5 +1,6 @@ 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("Plain text is wrapped in a paragraph") public void normalTextAsAParagraph() { String input = "This will be a paragraph"; String expected = "

This will be a paragraph

"; @@ -23,6 +25,7 @@ public void normalTextAsAParagraph() { @Disabled("Remove to run test") @Test + @DisplayName("Single underscore wraps text in tags") public void italics() { String input = "_This will be italic_"; String expected = "

This will be italic

"; @@ -32,6 +35,7 @@ public void italics() { @Disabled("Remove to run test") @Test + @DisplayName("Double underscore wraps text in tags") public void boldText() { String input = "__This will be bold__"; String expected = "

This will be bold

"; @@ -41,6 +45,7 @@ public void boldText() { @Disabled("Remove to run test") @Test + @DisplayName("Mixed italics and bold inline formatting") public void normalItalicsAndBoldText() { String input = "This will _be_ __mixed__"; String expected = "

This will be mixed

"; @@ -50,6 +55,7 @@ public void normalItalicsAndBoldText() { @Disabled("Remove to run test") @Test + @DisplayName("H1 header conversion") public void withH1HeaderLevel() { String input = "# This will be an h1"; String expected = "

This will be an h1

"; @@ -59,6 +65,7 @@ public void withH1HeaderLevel() { @Disabled("Remove to run test") @Test + @DisplayName("H2 header conversion") public void withH2HeaderLevel() { String input = "## This will be an h2"; String expected = "

This will be an h2

"; @@ -68,6 +75,7 @@ public void withH2HeaderLevel() { @Disabled("Remove to run test") @Test + @DisplayName("H3 header conversion") public void withH3HeaderLevel() { String input = "### This will be an h3"; String expected = "

This will be an h3

"; @@ -77,6 +85,7 @@ public void withH3HeaderLevel() { @Disabled("Remove to run test") @Test + @DisplayName("H4 header conversion") public void withH4HeaderLevel() { String input = "#### This will be an h4"; String expected = "

This will be an h4

"; @@ -86,6 +95,7 @@ public void withH4HeaderLevel() { @Disabled("Remove to run test") @Test + @DisplayName("H5 header conversion") public void withH5HeaderLevel() { String input = "##### This will be an h5"; String expected = "
This will be an h5
"; @@ -95,6 +105,7 @@ public void withH5HeaderLevel() { @Disabled("Remove to run test") @Test + @DisplayName("H6 header conversion") public void withH6HeaderLevel() { String input = "###### This will be an h6"; String expected = "
This will be an h6
"; @@ -104,6 +115,7 @@ public void withH6HeaderLevel() { @Disabled("Remove to run test") @Test + @DisplayName("Line starting with 7 hashes is a paragraph") public void h7HeaderLevelIsAParagraph() { String input = "####### This will not be an h7"; String expected = "

####### This will not be an h7

"; @@ -113,6 +125,7 @@ public void h7HeaderLevelIsAParagraph() { @Disabled("Remove to run test") @Test + @DisplayName("Consecutive lines starting with * become an unordered list") public void unorderedLists() { String input = "* Item 1\n* Item 2"; String expected = "
  • Item 1
  • Item 2
"; @@ -122,6 +135,7 @@ public void unorderedLists() { @Disabled("Remove to run test") @Test + @DisplayName("Combined header and list formatting") public void aLittleBitOfEverything() { String input = "# Header!\n* __Bold Item__\n* _Italic Item_"; String expected = "

Header!

  • Bold Item
  • Italic Item
"; @@ -131,6 +145,7 @@ public void aLittleBitOfEverything() { @Disabled("Remove to run test") @Test + @DisplayName("Markdown symbols inside headers are treated as text") public void markdownSymbolsInTheHeaderShouldNotBeInterpreted() { String input = "# This is a header with # and * in the text"; String expected = "

This is a header with # and * in the text

"; @@ -140,6 +155,7 @@ public void markdownSymbolsInTheHeaderShouldNotBeInterpreted() { @Disabled("Remove to run test") @Test + @DisplayName("Markdown symbols inside list items are treated as text") public void markdownSymbolsInTheListItemTextShouldNotBeInterpreted() { String input = "* Item 1 with a # in the text\n* Item 2 with * in the text"; String expected = "
  • Item 1 with a # in the text
  • Item 2 with * in the text
"; @@ -149,6 +165,7 @@ public void markdownSymbolsInTheListItemTextShouldNotBeInterpreted() { @Disabled("Remove to run test") @Test + @DisplayName("Markdown symbols inside paragraphs are treated as text") public void markdownSymbolsInTheParagraphTextShouldNotBeInterpreted() { String input = "This is a paragraph with # and * in the text"; String expected = "

This is a paragraph with # and * in the text

"; @@ -158,6 +175,7 @@ public void markdownSymbolsInTheParagraphTextShouldNotBeInterpreted() { @Disabled("Remove to run test") @Test + @DisplayName("Lists close properly when surrounded by other blocks") public void markdownUnorderedListsCloseProperlyWithPrecedingAndFollowingLines() { String input = "# Start a list\n* Item 1\n* Item 2\nEnd a list"; String expected = "

Start a list

  • Item 1
  • Item 2

End a list

"; From 991ec6ca206fcb414b40f86343717db7ce704c40 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Wed, 19 Nov 2025 00:21:40 +0530 Subject: [PATCH 15/22] Changes done as per canonical-data.json --- .../src/test/java/DnDCharacterTest.java | 36 ++++----- .../hangman/src/test/java/HangmanTest.java | 1 + .../markdown/src/test/java/MarkdownTest.java | 34 ++++----- .../src/test/java/BracketCheckerTest.java | 42 +++++------ .../java/ParallelLetterFrequencyTest.java | 26 +++---- .../java/PascalsTriangleGeneratorTest.java | 18 ++--- .../src/test/java/NaturalNumberTest.java | 22 +++--- .../src/test/java/PhoneNumberTest.java | 36 ++++----- .../src/test/java/PiecingItTogetherTest.java | 14 ++-- .../poker/src/test/java/PokerTest.java | 74 +++++++++---------- 10 files changed, 152 insertions(+), 151 deletions(-) diff --git a/exercises/practice/dnd-character/src/test/java/DnDCharacterTest.java b/exercises/practice/dnd-character/src/test/java/DnDCharacterTest.java index 203c1f7b4..c54ad52ac 100644 --- a/exercises/practice/dnd-character/src/test/java/DnDCharacterTest.java +++ b/exercises/practice/dnd-character/src/test/java/DnDCharacterTest.java @@ -11,112 +11,112 @@ public class DnDCharacterTest { private DnDCharacter dndCharacter = new DnDCharacter(); @Test - @DisplayName("Ability modifier for score 3 is -4") + @DisplayName("ability modifier for score 3 is -4") public void testAbilityModifierForScore3IsNegative4() { assertThat(dndCharacter.modifier(3)).isEqualTo(-4); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 4 is -3") + @DisplayName("ability modifier for score 4 is -3") public void testAbilityModifierForScore4IsNegative3() { assertThat(dndCharacter.modifier(4)).isEqualTo(-3); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 5 is -3") + @DisplayName("ability modifier for score 5 is -3") public void testAbilityModifierForScore5IsNegative3() { assertThat(dndCharacter.modifier(5)).isEqualTo(-3); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 6 is -2") + @DisplayName("ability modifier for score 6 is -2") public void testAbilityModifierForScore6IsNegative2() { assertThat(dndCharacter.modifier(6)).isEqualTo(-2); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 7 is -2") + @DisplayName("ability modifier for score 7 is -2") public void testAbilityModifierForScore7IsNegative2() { assertThat(dndCharacter.modifier(7)).isEqualTo(-2); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 8 is -1") + @DisplayName("ability modifier for score 8 is -1") public void testAbilityModifierForScore8IsNegative1() { assertThat(dndCharacter.modifier(8)).isEqualTo(-1); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 9 is -1") + @DisplayName("ability modifier for score 9 is -1") public void testAbilityModifierForScore9IsNegative1() { assertThat(dndCharacter.modifier(9)).isEqualTo(-1); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 10 is 0") + @DisplayName("ability modifier for score 10 is 0") public void testAbilityModifierForScore10Is0() { assertThat(dndCharacter.modifier(10)).isEqualTo(0); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 11 is 0") + @DisplayName("ability modifier for score 11 is 0") public void testAbilityModifierForScore11Is0() { assertThat(dndCharacter.modifier(11)).isEqualTo(0); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 12 is 1") + @DisplayName("ability modifier for score 12 is +1") public void testAbilityModifierForScore12Is1() { assertThat(dndCharacter.modifier(12)).isEqualTo(1); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 13 is 1") + @DisplayName("ability modifier for score 13 is +1") public void testAbilityModifierForScore13Is1() { assertThat(dndCharacter.modifier(13)).isEqualTo(1); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 14 is 2") + @DisplayName("ability modifier for score 14 is +2") public void testAbilityModifierForScore14Is2() { assertThat(dndCharacter.modifier(14)).isEqualTo(2); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 15 is 2") + @DisplayName("ability modifier for score 15 is +2") public void testAbilityModifierForScore15Is2() { assertThat(dndCharacter.modifier(15)).isEqualTo(2); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 16 is 3") + @DisplayName("ability modifier for score 16 is +3") public void testAbilityModifierForScore16Is3() { assertThat(dndCharacter.modifier(16)).isEqualTo(3); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 17 is 3") + @DisplayName("ability modifier for score 17 is +3") public void testAbilityModifierForScore17Is3() { assertThat(dndCharacter.modifier(17)).isEqualTo(3); } @Disabled("Remove to run test") @Test - @DisplayName("Ability modifier for score 18 is 4") + @DisplayName("ability modifier for score 18 is +4") public void testAbilityModifierForScore18Is4() { assertThat(dndCharacter.modifier(18)).isEqualTo(4); } @@ -190,7 +190,7 @@ public void testAbilityCalculationDoesNotChangeInputScores() { @Disabled("Remove to run test") @Test - @DisplayName("Random character attributes are within valid range") + @DisplayName("random character is valid") public void testRandomCharacterIsValid() { for (int i = 0; i < 1000; i++) { DnDCharacter character = new DnDCharacter(); @@ -206,7 +206,7 @@ public void testRandomCharacterIsValid() { @Disabled("Remove to run test") @Test - @DisplayName("Each ability value is calculated only once") + @DisplayName("each ability is only calculated once") public void testEachAbilityIsOnlyCalculatedOnce() { assertThat(dndCharacter.getStrength()).isEqualTo(dndCharacter.getStrength()); assertThat(dndCharacter.getDexterity()).isEqualTo(dndCharacter.getDexterity()); diff --git a/exercises/practice/hangman/src/test/java/HangmanTest.java b/exercises/practice/hangman/src/test/java/HangmanTest.java index a2215defe..039ce7ed3 100644 --- a/exercises/practice/hangman/src/test/java/HangmanTest.java +++ b/exercises/practice/hangman/src/test/java/HangmanTest.java @@ -1,6 +1,7 @@ import io.reactivex.Observable; import io.reactivex.ObservableEmitter; import io.reactivex.disposables.Disposable; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; diff --git a/exercises/practice/markdown/src/test/java/MarkdownTest.java b/exercises/practice/markdown/src/test/java/MarkdownTest.java index e4f51ead9..ec0f31d94 100644 --- a/exercises/practice/markdown/src/test/java/MarkdownTest.java +++ b/exercises/practice/markdown/src/test/java/MarkdownTest.java @@ -15,7 +15,7 @@ public void setup() { } @Test - @DisplayName("Plain text is wrapped in a paragraph") + @DisplayName("parses normal text as a paragraph") public void normalTextAsAParagraph() { String input = "This will be a paragraph"; String expected = "

This will be a paragraph

"; @@ -25,7 +25,7 @@ public void normalTextAsAParagraph() { @Disabled("Remove to run test") @Test - @DisplayName("Single underscore wraps text in tags") + @DisplayName("parsing italics") public void italics() { String input = "_This will be italic_"; String expected = "

This will be italic

"; @@ -35,7 +35,7 @@ public void italics() { @Disabled("Remove to run test") @Test - @DisplayName("Double underscore wraps text in tags") + @DisplayName("parsing bold text") public void boldText() { String input = "__This will be bold__"; String expected = "

This will be bold

"; @@ -45,7 +45,7 @@ public void boldText() { @Disabled("Remove to run test") @Test - @DisplayName("Mixed italics and bold inline formatting") + @DisplayName("mixed normal, italics and bold text") public void normalItalicsAndBoldText() { String input = "This will _be_ __mixed__"; String expected = "

This will be mixed

"; @@ -55,7 +55,7 @@ public void normalItalicsAndBoldText() { @Disabled("Remove to run test") @Test - @DisplayName("H1 header conversion") + @DisplayName("with h1 header level") public void withH1HeaderLevel() { String input = "# This will be an h1"; String expected = "

This will be an h1

"; @@ -65,7 +65,7 @@ public void withH1HeaderLevel() { @Disabled("Remove to run test") @Test - @DisplayName("H2 header conversion") + @DisplayName("with h2 header level") public void withH2HeaderLevel() { String input = "## This will be an h2"; String expected = "

This will be an h2

"; @@ -75,7 +75,7 @@ public void withH2HeaderLevel() { @Disabled("Remove to run test") @Test - @DisplayName("H3 header conversion") + @DisplayName("with h3 header level") public void withH3HeaderLevel() { String input = "### This will be an h3"; String expected = "

This will be an h3

"; @@ -85,7 +85,7 @@ public void withH3HeaderLevel() { @Disabled("Remove to run test") @Test - @DisplayName("H4 header conversion") + @DisplayName("with h4 header level") public void withH4HeaderLevel() { String input = "#### This will be an h4"; String expected = "

This will be an h4

"; @@ -95,7 +95,7 @@ public void withH4HeaderLevel() { @Disabled("Remove to run test") @Test - @DisplayName("H5 header conversion") + @DisplayName("with h5 header level") public void withH5HeaderLevel() { String input = "##### This will be an h5"; String expected = "
This will be an h5
"; @@ -105,7 +105,7 @@ public void withH5HeaderLevel() { @Disabled("Remove to run test") @Test - @DisplayName("H6 header conversion") + @DisplayName("with h6 header level") public void withH6HeaderLevel() { String input = "###### This will be an h6"; String expected = "
This will be an h6
"; @@ -115,7 +115,7 @@ public void withH6HeaderLevel() { @Disabled("Remove to run test") @Test - @DisplayName("Line starting with 7 hashes is a paragraph") + @DisplayName("h7 header level is a paragraph") public void h7HeaderLevelIsAParagraph() { String input = "####### This will not be an h7"; String expected = "

####### This will not be an h7

"; @@ -125,7 +125,7 @@ public void h7HeaderLevelIsAParagraph() { @Disabled("Remove to run test") @Test - @DisplayName("Consecutive lines starting with * become an unordered list") + @DisplayName("unordered lists") public void unorderedLists() { String input = "* Item 1\n* Item 2"; String expected = "
  • Item 1
  • Item 2
"; @@ -135,7 +135,7 @@ public void unorderedLists() { @Disabled("Remove to run test") @Test - @DisplayName("Combined header and list formatting") + @DisplayName("With a little bit of everything") public void aLittleBitOfEverything() { String input = "# Header!\n* __Bold Item__\n* _Italic Item_"; String expected = "

Header!

  • Bold Item
  • Italic Item
"; @@ -145,7 +145,7 @@ public void aLittleBitOfEverything() { @Disabled("Remove to run test") @Test - @DisplayName("Markdown symbols inside headers are treated as text") + @DisplayName("with markdown symbols in the header text that should not be interpreted") public void markdownSymbolsInTheHeaderShouldNotBeInterpreted() { String input = "# This is a header with # and * in the text"; String expected = "

This is a header with # and * in the text

"; @@ -155,7 +155,7 @@ public void markdownSymbolsInTheHeaderShouldNotBeInterpreted() { @Disabled("Remove to run test") @Test - @DisplayName("Markdown symbols inside list items are treated as text") + @DisplayName("with markdown symbols in the list item text that should not be interpreted") public void markdownSymbolsInTheListItemTextShouldNotBeInterpreted() { String input = "* Item 1 with a # in the text\n* Item 2 with * in the text"; String expected = "
  • Item 1 with a # in the text
  • Item 2 with * in the text
"; @@ -165,7 +165,7 @@ public void markdownSymbolsInTheListItemTextShouldNotBeInterpreted() { @Disabled("Remove to run test") @Test - @DisplayName("Markdown symbols inside paragraphs are treated as text") + @DisplayName("with markdown symbols in the paragraph text that should not be interpreted") public void markdownSymbolsInTheParagraphTextShouldNotBeInterpreted() { String input = "This is a paragraph with # and * in the text"; String expected = "

This is a paragraph with # and * in the text

"; @@ -175,7 +175,7 @@ public void markdownSymbolsInTheParagraphTextShouldNotBeInterpreted() { @Disabled("Remove to run test") @Test - @DisplayName("Lists close properly when surrounded by other blocks") + @DisplayName("unordered lists close properly with preceding and following lines") public void markdownUnorderedListsCloseProperlyWithPrecedingAndFollowingLines() { String input = "# Start a list\n* Item 1\n* Item 2\nEnd a list"; String expected = "

Start a list

  • Item 1
  • Item 2

End a list

"; diff --git a/exercises/practice/matching-brackets/src/test/java/BracketCheckerTest.java b/exercises/practice/matching-brackets/src/test/java/BracketCheckerTest.java index 9539985cf..9051b388c 100644 --- a/exercises/practice/matching-brackets/src/test/java/BracketCheckerTest.java +++ b/exercises/practice/matching-brackets/src/test/java/BracketCheckerTest.java @@ -7,7 +7,7 @@ public class BracketCheckerTest { @Test - @DisplayName("Paired square brackets are matched and valid") + @DisplayName("paired square brackets") public void testPairedSquareBrackets() { BracketChecker bracketChecker = new BracketChecker("[]"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -15,7 +15,7 @@ public void testPairedSquareBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Empty string contains no brackets and is valid") + @DisplayName("empty string") public void testEmptyString() { BracketChecker bracketChecker = new BracketChecker(""); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -23,7 +23,7 @@ public void testEmptyString() { @Disabled("Remove to run test") @Test - @DisplayName("Unpaired brackets are invalid") + @DisplayName("unpaired brackets") public void testUnpairedBrackets() { BracketChecker bracketChecker = new BracketChecker("[["); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -31,7 +31,7 @@ public void testUnpairedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Wrong ordered brackets are invalid") + @DisplayName("wrong ordered brackets") public void testWrongOrderedBrackets() { BracketChecker bracketChecker = new BracketChecker("}{"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -39,7 +39,7 @@ public void testWrongOrderedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Wrong closing bracket type is invalid") + @DisplayName("wrong closing bracket") public void testWrongClosingBracket() { BracketChecker bracketChecker = new BracketChecker("{]"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -47,7 +47,7 @@ public void testWrongClosingBracket() { @Disabled("Remove to run test") @Test - @DisplayName("Paired brackets with whitespace are valid") + @DisplayName("paired with whitespace") public void testPairedWithWhitespace() { BracketChecker bracketChecker = new BracketChecker("{ }"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -55,7 +55,7 @@ public void testPairedWithWhitespace() { @Disabled("Remove to run test") @Test - @DisplayName("Partially paired brackets are invalid") + @DisplayName("partially paired brackets") public void testPartiallyPairedBrackets() { BracketChecker bracketChecker = new BracketChecker("{[])"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -63,7 +63,7 @@ public void testPartiallyPairedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Simple nested brackets are valid") + @DisplayName("simple nested brackets") public void testSimpleNestedBrackets() { BracketChecker bracketChecker = new BracketChecker("{[]}"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -71,7 +71,7 @@ public void testSimpleNestedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Several paired brackets in sequence are valid") + @DisplayName("several paired brackets") public void testSeveralPairedBrackets() { BracketChecker bracketChecker = new BracketChecker("{}[]"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -79,7 +79,7 @@ public void testSeveralPairedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Paired and nested complex brackets are valid") + @DisplayName("paired and nested brackets") public void testPairedAndNestedBrackets() { BracketChecker bracketChecker = new BracketChecker("([{}({}[])])"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -87,7 +87,7 @@ public void testPairedAndNestedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Unopened closing bracket is invalid") + @DisplayName("unopened closing brackets") public void testUnopenedClosingBracket() { BracketChecker bracketChecker = new BracketChecker("{[)][]}"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -95,7 +95,7 @@ public void testUnopenedClosingBracket() { @Disabled("Remove to run test") @Test - @DisplayName("Unpaired and nested brackets are invalid") + @DisplayName("unpaired and nested brackets") public void testUnpairedAndNestedBrackets() { BracketChecker bracketChecker = new BracketChecker("([{])"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -103,7 +103,7 @@ public void testUnpairedAndNestedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Paired but wrongly nested brackets are invalid") + @DisplayName("paired and wrong nested brackets") public void testPairedAndWrongNestedBrackets() { BracketChecker bracketChecker = new BracketChecker("[({]})"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -111,7 +111,7 @@ public void testPairedAndWrongNestedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Innermost correct but overall wrong nesting is invalid") + @DisplayName("paired and wrong nested brackets but innermost are correct") public void testPairedAndWrongNestedBracketsButInnermostAreCorrect() { BracketChecker bracketChecker = new BracketChecker("[({}])"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -119,7 +119,7 @@ public void testPairedAndWrongNestedBracketsButInnermostAreCorrect() { @Disabled("Remove to run test") @Test - @DisplayName("Paired and incomplete brackets are invalid") + @DisplayName("paired and incomplete brackets") public void testPairedAndIncompleteBrackets() { BracketChecker bracketChecker = new BracketChecker("{}["); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -127,7 +127,7 @@ public void testPairedAndIncompleteBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Too many closing brackets are invalid") + @DisplayName("too many closing brackets") public void testTooManyClosingBrackets() { BracketChecker bracketChecker = new BracketChecker("[]]"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -135,15 +135,15 @@ public void testTooManyClosingBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Early unexpected closing bracket is invalid") + @DisplayName("early unexpected brackets") public void testEarlyUnexpectedBrackets() { BracketChecker bracketChecker = new BracketChecker(")()"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); } - + @Disabled("Remove to run test") @Test - @DisplayName("Early mismatched brackets are invalid") + @DisplayName("early mismatched brackets") public void testEarlyMismatchedBrackets() { BracketChecker bracketChecker = new BracketChecker("{)()"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isFalse(); @@ -151,7 +151,7 @@ public void testEarlyMismatchedBrackets() { @Disabled("Remove to run test") @Test - @DisplayName("Math expression with balanced parentheses is valid") + @DisplayName("math expression") public void testMathExpression() { BracketChecker bracketChecker = new BracketChecker("(((185 + 223.85) * 15) - 543)/2"); assertThat(bracketChecker.areBracketsMatchedAndNestedCorrectly()).isTrue(); @@ -159,7 +159,7 @@ public void testMathExpression() { @Disabled("Remove to run test") @Test - @DisplayName("Complex LaTeX expression with matched brackets is valid") + @DisplayName("complex latex expression") public void testComplexLatexExpression() { BracketChecker bracketChecker = new BracketChecker( "\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)"); diff --git a/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java b/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java index 90d4e1527..c26c07c09 100644 --- a/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java +++ b/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java @@ -206,7 +206,7 @@ public class ParallelLetterFrequencyTest { "- from the days of the Flood to the Schleswig-Holstein period."; @Test - @DisplayName("No input texts yields empty frequency map") + @DisplayName("no texts") public void testNoTexts() { String[] input = {}; Map expectedOutput = new HashMap<>(); @@ -217,7 +217,7 @@ public void testNoTexts() { @Disabled("Remove to run test") @Test - @DisplayName("Single text with a single letter counted") + @DisplayName("one text with one letter") public void testOneTextWithOneLetter() { String[] input = { "a" }; Map expectedOutput = new HashMap<>() { @@ -232,7 +232,7 @@ public void testOneTextWithOneLetter() { @Disabled("Remove to run test") @Test - @DisplayName("Single text with repeated letters counted correctly") + @DisplayName("one text with multiple letters") public void testOneTextWithMultipleLetters() { String[] input = { "bbcccd" }; Map expectedOutput = new HashMap<>() { @@ -249,7 +249,7 @@ public void testOneTextWithMultipleLetters() { @Disabled("Remove to run test") @Test - @DisplayName("Two texts each with one distinct letter counted") + @DisplayName("two texts with one letter") public void testTwoTextsWithOneLetter() { String[] input = { "e", "f" }; Map expectedOutput = new HashMap<>() { @@ -265,7 +265,7 @@ public void testTwoTextsWithOneLetter() { @Disabled("Remove to run test") @Test - @DisplayName("Two texts with overlapping letters aggregated correctly") + @DisplayName("two texts with multiple letters") public void testTwoTextsWithMultipleLetters() { String[] input = { "ggh", "hhi" }; Map expectedOutput = new HashMap<>() { @@ -282,7 +282,7 @@ public void testTwoTextsWithMultipleLetters() { @Disabled("Remove to run test") @Test - @DisplayName("Letter counting is case-insensitive") + @DisplayName("ignore letter casing") public void testIgnoreLetterCasing() { String[] input = { "m", "M" }; Map expectedOutput = new HashMap<>() { @@ -297,7 +297,7 @@ public void testIgnoreLetterCasing() { @Disabled("Remove to run test") @Test - @DisplayName("Whitespace-only inputs are ignored") + @DisplayName("ignore whitespace") public void testIgnoreWhitespace() { String[] input = { " ", "\t", "\r\n" }; Map expectedOutput = new HashMap<>(); @@ -308,7 +308,7 @@ public void testIgnoreWhitespace() { @Disabled("Remove to run test") @Test - @DisplayName("Punctuation-only inputs are ignored") + @DisplayName("ignore punctuation") public void testIgnorePunctuation() { String[] input = { "!", "?", ";", ",", "." }; Map expectedOutput = new HashMap<>(); @@ -319,7 +319,7 @@ public void testIgnorePunctuation() { @Disabled("Remove to run test") @Test - @DisplayName("Numeric characters are ignored") + @DisplayName("ignore numbers") public void testIgnoreNumbers() { String[] input = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; Map expectedOutput = new HashMap<>(); @@ -330,7 +330,7 @@ public void testIgnoreNumbers() { @Disabled("Remove to run test") @Test - @DisplayName("Unicode letters are counted correctly") + @DisplayName("Unicode letters") public void testUnicodeLetters() { String[] input = { "本", "φ", "ほ", "ø" }; Map expectedOutput = new HashMap<>() { @@ -348,7 +348,7 @@ public void testUnicodeLetters() { @Disabled("Remove to run test") @Test - @DisplayName("Complex mixture of casing, punctuation and whitespace counted correctly") + @DisplayName("combination of lower- and uppercase letters, punctuation and white space") public void testCombinationOfLowerAndUppercaseLettersPunctuationAndWhiteSpace() { String[] input = {calculateFrequencies}; Map expectedOutput = new HashMap<>() { @@ -384,7 +384,7 @@ public void testCombinationOfLowerAndUppercaseLettersPunctuationAndWhiteSpace() @Disabled("Remove to run test") @Test - @DisplayName("Many small identical texts aggregate correctly") + @DisplayName("many small texts") public void testManySmallTexts() { String[] input = new String[50]; Arrays.fill(input, "abbccc"); @@ -402,7 +402,7 @@ public void testManySmallTexts() { @Disabled("Remove to run test") @Test - @DisplayName("Large texts are counted correctly") + @DisplayName("large texts") public void testLargeTexts() { String[] input = { largeTexts1, largeTexts2, largeTexts3, largeTexts4 }; Map expectedOutput = new HashMap<>() { diff --git a/exercises/practice/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java b/exercises/practice/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java index fa434b4ad..becdb0825 100644 --- a/exercises/practice/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java +++ b/exercises/practice/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java @@ -1,6 +1,6 @@ import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -10,7 +10,7 @@ public class PascalsTriangleGeneratorTest { new PascalsTriangleGenerator(); @Test - @DisplayName("Zero rows produces empty triangle") + @DisplayName("zero rows") public void testTriangleWithZeroRows() { int[][] expectedOutput = new int[][]{}; @@ -19,7 +19,7 @@ public void testTriangleWithZeroRows() { @Disabled("Remove to run test") @Test - @DisplayName("One row produces single element row") + @DisplayName("single row") public void testTriangleWithOneRow() { int[][] expectedOutput = new int[][]{ {1} @@ -30,7 +30,7 @@ public void testTriangleWithOneRow() { @Disabled("Remove to run test") @Test - @DisplayName("Two rows produce proper Pascal triangle") + @DisplayName("two rows") public void testTriangleWithTwoRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -42,7 +42,7 @@ public void testTriangleWithTwoRows() { @Disabled("Remove to run test") @Test - @DisplayName("Three rows produce proper Pascal triangle") + @DisplayName("three rows") public void testTriangleWithThreeRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -55,7 +55,7 @@ public void testTriangleWithThreeRows() { @Disabled("Remove to run test") @Test - @DisplayName("Four rows produce proper Pascal triangle") + @DisplayName("four rows") public void testTriangleWithFourRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -69,7 +69,7 @@ public void testTriangleWithFourRows() { @Disabled("Remove to run test") @Test - @DisplayName("Five rows produce proper Pascal triangle") + @DisplayName("five rows") public void testTriangleWithFiveRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -84,7 +84,7 @@ public void testTriangleWithFiveRows() { @Disabled("Remove to run test") @Test - @DisplayName("Six rows produce proper Pascal triangle") + @DisplayName("six rows") public void testTriangleWithSixRows() { int[][] expectedOutput = new int[][]{ {1}, @@ -100,7 +100,7 @@ public void testTriangleWithSixRows() { @Disabled("Remove to run test") @Test - @DisplayName("Ten rows produce correct Pascal triangle up to 10") + @DisplayName("ten rows") public void testTriangleWithTenRows() { int[][] expectedOutput = new int[][]{ {1}, diff --git a/exercises/practice/perfect-numbers/src/test/java/NaturalNumberTest.java b/exercises/practice/perfect-numbers/src/test/java/NaturalNumberTest.java index e4abc9aad..58af24598 100644 --- a/exercises/practice/perfect-numbers/src/test/java/NaturalNumberTest.java +++ b/exercises/practice/perfect-numbers/src/test/java/NaturalNumberTest.java @@ -8,56 +8,56 @@ public class NaturalNumberTest { @Test - @DisplayName("Small perfect number (6) is classified as PERFECT") + @DisplayName("Smallest perfect number is classified correctly") public void testSmallPerfectNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(6).getClassification()).isEqualTo(Classification.PERFECT); } @Disabled("Remove to run test") @Test - @DisplayName("Medium perfect number (28) is classified as PERFECT") + @DisplayName("Medium perfect number is classified correctly") public void testMediumPerfectNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(28).getClassification()).isEqualTo(Classification.PERFECT); } @Disabled("Remove to run test") @Test - @DisplayName("Large perfect number is classified as PERFECT") + @DisplayName("Large perfect number is classified correctly") public void testLargePerfectNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(33550336).getClassification()).isEqualTo(Classification.PERFECT); } @Disabled("Remove to run test") @Test - @DisplayName("Small abundant number is classified as ABUNDANT") + @DisplayName("Smallest abundant number is classified correctly") public void testSmallAbundantNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(12).getClassification()).isEqualTo(Classification.ABUNDANT); } @Disabled("Remove to run test") @Test - @DisplayName("Medium abundant number is classified as ABUNDANT") + @DisplayName("Medium abundant number is classified correctly") public void testMediumAbundantNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(30).getClassification()).isEqualTo(Classification.ABUNDANT); } @Disabled("Remove to run test") @Test - @DisplayName("Large abundant number is classified as ABUNDANT") + @DisplayName("Large abundant number is classified correctly") public void testLargeAbundantNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(33550335).getClassification()).isEqualTo(Classification.ABUNDANT); } @Disabled("Remove to run test") @Test - @DisplayName("Smallest prime number (2) is classified as DEFICIENT") + @DisplayName("Smallest prime deficient number is classified correctly") public void testSmallestPrimeDeficientNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(2).getClassification()).isEqualTo(Classification.DEFICIENT); } @Disabled("Remove to run test") @Test - @DisplayName("Smallest non-prime deficient number (4) is classified as DEFICIENT") + @DisplayName("Smallest non-prime deficient number is classified correctly") public void testSmallestNonPrimeDeficientNumberIsClassifiedCorrectly() { assertThat(new NaturalNumber(4).getClassification()).isEqualTo(Classification.DEFICIENT); } @@ -78,7 +78,7 @@ public void testLargeDeficientNumberIsClassifiedCorrectly() { @Disabled("Remove to run test") @Test - @DisplayName("One is classified as DEFICIENT (no proper divisors)") + @DisplayName("Edge case (no factors other than itself) is classified correctly") /* * The number 1 has no proper divisors (https://en.wikipedia.org/wiki/Divisor#Further_notions_and_facts), and the * additive identity is 0, so the aliquot sum of 1 should be 0. Hence 1 should be classified as deficient. @@ -89,7 +89,7 @@ public void testThatOneIsCorrectlyClassifiedAsDeficient() { @Disabled("Remove to run test") @Test - @DisplayName("Zero is rejected as not a natural number") + @DisplayName("Zero is rejected (as it is not a positive integer)") public void testThatNonNegativeIntegerIsRejected() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new NaturalNumber(0)) @@ -98,7 +98,7 @@ public void testThatNonNegativeIntegerIsRejected() { @Disabled("Remove to run test") @Test - @DisplayName("Negative integers are rejected") + @DisplayName("Negative integer is rejected (as it is not a positive integer)") public void testThatNegativeIntegerIsRejected() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new NaturalNumber(-1)) diff --git a/exercises/practice/phone-number/src/test/java/PhoneNumberTest.java b/exercises/practice/phone-number/src/test/java/PhoneNumberTest.java index 4971bc472..300415b65 100644 --- a/exercises/practice/phone-number/src/test/java/PhoneNumberTest.java +++ b/exercises/practice/phone-number/src/test/java/PhoneNumberTest.java @@ -8,7 +8,7 @@ public class PhoneNumberTest { @Test - @DisplayName("Cleans common formatted number to digits only") + @DisplayName("cleans the number") public void cleansTheNumber() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("(223) 456-7890").getNumber(); @@ -18,7 +18,7 @@ public void cleansTheNumber() { @Disabled("Remove to run test") @Test - @DisplayName("Cleans numbers with dots to digits only") + @DisplayName("cleans numbers with dots") public void cleansNumbersWithDots() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("223.456.7890").getNumber(); @@ -29,7 +29,7 @@ public void cleansNumbersWithDots() { @Disabled("Remove to run test") @Test - @DisplayName("Cleans numbers with multiple spaces") + @DisplayName("cleans numbers with multiple spaces") public void cleansNumbersWithMultipleSpaces() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("223 456 7890 ").getNumber(); @@ -39,7 +39,7 @@ public void cleansNumbersWithMultipleSpaces() { @Disabled("Remove to run test") @Test - @DisplayName("Nine digit numbers are invalid") + @DisplayName("invalid when 9 digits") public void invalidWhen9Digits() { assertThatExceptionOfType(IllegalArgumentException.class) @@ -49,7 +49,7 @@ public void invalidWhen9Digits() { @Disabled("Remove to run test") @Test - @DisplayName("Eleven digits not starting with 1 are invalid") + @DisplayName("invalid when 11 digits does not start with a 1") public void invalidWhen11DigitsDoesNotStartWith1() { assertThatExceptionOfType(IllegalArgumentException.class) @@ -59,7 +59,7 @@ public void invalidWhen11DigitsDoesNotStartWith1() { @Disabled("Remove to run test") @Test - @DisplayName("Eleven digits starting with 1 are accepted and trimmed") + @DisplayName("valid when 11 digits and starting with 1") public void validWhen11DigitsAndStartingWith1() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("12234567890").getNumber(); @@ -69,7 +69,7 @@ public void validWhen11DigitsAndStartingWith1() { @Disabled("Remove to run test") @Test - @DisplayName("Valid 11-digit number with punctuation is accepted") + @DisplayName("valid when 11 digits and starting with 1 even with punctuation") public void validWhen11DigitsAndStartingWith1EvenWithPunctuation() { String expectedNumber = "2234567890"; String actualNumber = new PhoneNumber("+1 (223) 456-7890").getNumber(); @@ -79,7 +79,7 @@ public void validWhen11DigitsAndStartingWith1EvenWithPunctuation() { @Disabled("Remove to run test") @Test - @DisplayName("More than 11 digits is invalid") + @DisplayName("invalid when more than 11 digits") public void invalidWhenMoreThan11Digits() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("321234567890")) @@ -88,7 +88,7 @@ public void invalidWhenMoreThan11Digits() { @Disabled("Remove to run test") @Test - @DisplayName("Letters in number are not permitted") + @DisplayName("invalid with letters") public void invalidWithLetters() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("523-abc-7890")) @@ -97,7 +97,7 @@ public void invalidWithLetters() { @Disabled("Remove to run test") @Test - @DisplayName("Unsupported punctuations are not permitted") + @DisplayName("invalid with punctuations") public void invalidWithPunctuations() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("523-@:!-7890")) @@ -106,7 +106,7 @@ public void invalidWithPunctuations() { @Disabled("Remove to run test") @Test - @DisplayName("Area code starting with 0 is invalid") + @DisplayName("invalid if area code starts with 0") public void invalidIfAreaCodeStartsWith0() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("(023) 456-7890")) @@ -115,7 +115,7 @@ public void invalidIfAreaCodeStartsWith0() { @Disabled("Remove to run test") @Test - @DisplayName("Area code starting with 1 is invalid") + @DisplayName("invalid if area code starts with 1") public void invalidIfAreaCodeStartsWith1() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("(123) 456-7890")) @@ -124,7 +124,7 @@ public void invalidIfAreaCodeStartsWith1() { @Disabled("Remove to run test") @Test - @DisplayName("Exchange code starting with 0 is invalid") + @DisplayName("invalid if exchange code starts with 0") public void invalidIfExchangeCodeStartsWith0() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("(223) 056-7890")) @@ -133,7 +133,7 @@ public void invalidIfExchangeCodeStartsWith0() { @Disabled("Remove to run test") @Test - @DisplayName("Exchange code starting with 1 is invalid") + @DisplayName("invalid if exchange code starts with 1") public void invalidIfExchangeCodeStartsWith1() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("(223) 156-7890")) @@ -142,7 +142,7 @@ public void invalidIfExchangeCodeStartsWith1() { @Disabled("Remove to run test") @Test - @DisplayName("Area code starting with 0 invalid on valid 11-digit number") + @DisplayName("invalid if area code starts with 0 on valid 11-digit number") public void invalidIfAreaCodeStartsWith0OnValid11DigitNumber() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("1 (023) 456-7890")) @@ -151,7 +151,7 @@ public void invalidIfAreaCodeStartsWith0OnValid11DigitNumber() { @Disabled("Remove to run test") @Test - @DisplayName("Area code starting with 1 invalid on valid 11-digit number") + @DisplayName("invalid if area code starts with 1 on valid 11-digit number") public void invalidIfAreaCodeStartsWith1OnValid11DigitNumber() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("1 (123) 456-7890")) @@ -160,7 +160,7 @@ public void invalidIfAreaCodeStartsWith1OnValid11DigitNumber() { @Disabled("Remove to run test") @Test - @DisplayName("Exchange code starting with 0 invalid on valid 11-digit number") + @DisplayName("invalid if exchange code starts with 0 on valid 11-digit number") public void invalidIfExchangeCodeStartsWith0OnValid11DigitNumber() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("1 (223) 056-7890")) @@ -169,7 +169,7 @@ public void invalidIfExchangeCodeStartsWith0OnValid11DigitNumber() { @Disabled("Remove to run test") @Test - @DisplayName("Exchange code starting with 1 invalid on valid 11-digit number") + @DisplayName("invalid if exchange code starts with 1 on valid 11-digit number") public void invalidIfExchangeCodeStartsWith1OnValid11DigitNumber() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new PhoneNumber("1 (223) 156-7890")) diff --git a/exercises/practice/piecing-it-together/src/test/java/PiecingItTogetherTest.java b/exercises/practice/piecing-it-together/src/test/java/PiecingItTogetherTest.java index dbd856080..791302fa3 100644 --- a/exercises/practice/piecing-it-together/src/test/java/PiecingItTogetherTest.java +++ b/exercises/practice/piecing-it-together/src/test/java/PiecingItTogetherTest.java @@ -9,7 +9,7 @@ public class PiecingItTogetherTest { private static final double DOUBLE_EQUALITY_TOLERANCE = 1e-9; @Test - @DisplayName("Complete information from pieces and aspect ratio is calculated") + @DisplayName("1000 pieces puzzle with 1.6 aspect ratio") public void test1000PiecesWithAspectRatio() { JigsawInfo input = new JigsawInfo.Builder() .pieces(1000) @@ -32,7 +32,7 @@ public void test1000PiecesWithAspectRatio() { @Disabled("Remove to run test") @Test - @DisplayName("Square puzzle specified by rows yields expected info") + @DisplayName("square puzzle with 32 rows") public void testSquarePuzzleWith32Rows() { JigsawInfo input = new JigsawInfo.Builder() .rows(32) @@ -55,7 +55,7 @@ public void testSquarePuzzleWith32Rows() { @Disabled("Remove to run test") @Test - @DisplayName("Inside count and aspect ratio determine full info") + @DisplayName("400 pieces square puzzle with only inside pieces and aspect ratio") public void testInsideAndAspectRatioOnly() { JigsawInfo input = new JigsawInfo.Builder() .inside(324) @@ -78,7 +78,7 @@ public void testInsideAndAspectRatioOnly() { @Disabled("Remove to run test") @Test - @DisplayName("Landscape puzzle with given rows and aspect returns expected info") + @DisplayName("1500 pieces landscape puzzle with 30 rows and 1.6 aspect ratio") public void testLandscape1500WithRowsAndAspect() { JigsawInfo input = new JigsawInfo.Builder() .rows(30) @@ -101,7 +101,7 @@ public void testLandscape1500WithRowsAndAspect() { @Disabled("Remove to run test") @Test - @DisplayName("Portrait puzzle with pieces and border returns expected info") + @DisplayName("300 pieces portrait puzzle with 70 border pieces") public void test300PiecesPortraitWithBorder() { JigsawInfo input = new JigsawInfo.Builder() .pieces(300) @@ -125,7 +125,7 @@ public void test300PiecesPortraitWithBorder() { @Disabled("Remove to run test") @Test - @DisplayName("Insufficient data throws IllegalArgumentException") + @DisplayName("puzzle with insufficient data") public void testInsufficientData() { JigsawInfo input = new JigsawInfo.Builder() .pieces(1500) @@ -139,7 +139,7 @@ public void testInsufficientData() { @Disabled("Remove to run test") @Test - @DisplayName("Contradictory data throws IllegalArgumentException") + @DisplayName("puzzle with contradictory data") public void testContradictoryData() { JigsawInfo input = new JigsawInfo.Builder() .rows(100) diff --git a/exercises/practice/poker/src/test/java/PokerTest.java b/exercises/practice/poker/src/test/java/PokerTest.java index a87b697ec..367b776df 100644 --- a/exercises/practice/poker/src/test/java/PokerTest.java +++ b/exercises/practice/poker/src/test/java/PokerTest.java @@ -9,7 +9,7 @@ public class PokerTest { @Test - @DisplayName("Single hand returns itself as best hand") + @DisplayName("single hand always wins") public void oneHand() { String hand = "4S 5S 7H 8D JC"; assertThat(new Poker(Collections.singletonList(hand)).getBestHands()) @@ -18,7 +18,7 @@ public void oneHand() { @Disabled("Remove to run test") @Test - @DisplayName("Highest single high card wins") + @DisplayName("highest card out of all hands wins") public void highestCardWins() { String highest8 = "4D 5S 6S 8D 3C"; String highest10 = "2S 4C 7S 9H 10H"; @@ -29,7 +29,7 @@ public void highestCardWins() { @Disabled("Remove to run test") @Test - @DisplayName("Tie results in multiple winners") + @DisplayName("a tie has multiple winners") public void tieHasMultipleWinners() { String highest8 = "4D 5S 6S 8D 3C"; String highest10 = "2S 4C 7S 9H 10H"; @@ -41,7 +41,7 @@ public void tieHasMultipleWinners() { @Disabled("Remove to run test") @Test - @DisplayName("Same high cards compared by next highest card") + @DisplayName("multiple hands with the same high cards, tie compares next highest ranked, down to last card") public void sameHighCards() { String nextHighest3 = "3S 5H 6S 8D 7H"; String nextHighest2 = "2S 5D 6D 8C 7S"; @@ -51,7 +51,7 @@ public void sameHighCards() { @Disabled("Remove to run test") @Test - @DisplayName("Winning determined by lowest card when needed") + @DisplayName("winning high card hand also has the lowest card") public void winningWithLowestCard() { String lowest2 = "2S 5H 6S 8D 7H"; String lowest3 = "3S 4D 6D 8C 7S"; @@ -61,7 +61,7 @@ public void winningWithLowestCard() { @Disabled("Remove to run test") @Test - @DisplayName("One pair beats nothing") + @DisplayName("one pair beats high card") public void nothingVsOnePair() { String nothing = "4S 5H 6C 8D KH"; String pairOf4 = "2S 4H 6S 4D JH"; @@ -71,7 +71,7 @@ public void nothingVsOnePair() { @Disabled("Remove to run test") @Test - @DisplayName("Compare two pairs correctly") + @DisplayName("highest pair wins") public void twoPairs() { String pairOf2 = "4S 2H 6S 2D JH"; String pairOf4 = "2S 4H 6C 4D JD"; @@ -81,7 +81,7 @@ public void twoPairs() { @Disabled("Remove to run test") @Test - @DisplayName("Same pair compare by kickers") + @DisplayName("both hands have the same pair, high card wins") public void samePair() { String pairOf4Lower = "4H 4S AH JC 3D"; String pairOf4Higher = "4C 4D AS 5D 6C"; @@ -91,7 +91,7 @@ public void samePair() { @Disabled("Remove to run test") @Test - @DisplayName("Double pair beats single pair") + @DisplayName("two pairs beats one pair") public void onePairVsDoublePair() { String pairOf8 = "2S 8H 6S 8D JH"; String doublePair = "4S 5H 4C 8C 5C"; @@ -101,7 +101,7 @@ public void onePairVsDoublePair() { @Disabled("Remove to run test") @Test - @DisplayName("Compare two double pairs") + @DisplayName("both hands have two pairs, highest ranked pair wins") public void twoDoublePairs() { String doublePair2And8 = "2S 8H 2D 8D 3H"; String doublePair4And5 = "4S 5H 4C 8S 5D"; @@ -111,7 +111,7 @@ public void twoDoublePairs() { @Disabled("Remove to run test") @Test - @DisplayName("Highest pair compared when same pair values") + @DisplayName("both hands have two pairs, with the same highest ranked pair, tie goes to low pair") public void sameHighestPair() { String doublePair2AndQ = "2S QS 2C QD JH"; String doublePairJAndQ = "JD QH JS 8D QC"; @@ -121,7 +121,7 @@ public void sameHighestPair() { @Disabled("Remove to run test") @Test - @DisplayName("Identically ranked pairs resolved by kicker") + @DisplayName("both hands have two identically ranked pairs, tie goes to remaining card (kicker)") public void identicallyRankedPairs() { String kicker8 = "JD QH JS 8D QC"; String kicker2 = "JS QS JC 2D QD"; @@ -131,7 +131,7 @@ public void identicallyRankedPairs() { @Disabled("Remove to run test") @Test - @DisplayName("Two pairs summing to same value compared correctly") + @DisplayName("both hands have two pairs that add to the same value, win goes to highest pair") public void twoPairsAddingToSameValue() { String doublePair6And3 = "6S 6H 3S 3H AS"; String doublePair7And2 = "7H 7S 2H 2S AC"; @@ -141,7 +141,7 @@ public void twoPairsAddingToSameValue() { @Disabled("Remove to run test") @Test - @DisplayName("Ranked by largest pair value first") + @DisplayName("two pairs first ranked by largest pair") public void rankedByLargestPair() { String doublePairs5And4 = "5C 2S 5S 4H 4C"; String doublePairs6And2 = "6S 2S 6H 7C 2C"; @@ -151,7 +151,7 @@ public void rankedByLargestPair() { @Disabled("Remove to run test") @Test - @DisplayName("Three-of-a-kind beats two pairs") + @DisplayName("three of a kind beats two pair") public void doublePairVsThree() { String doublePair2And8 = "2S 8H 2H 8D JH"; String threeOf4 = "4S 5H 4C 8S 4H"; @@ -161,7 +161,7 @@ public void doublePairVsThree() { @Disabled("Remove to run test") @Test - @DisplayName("Compare two three-of-a-kinds") + @DisplayName("both hands have three of a kind, tie goes to highest ranked triplet") public void twoThrees() { String threeOf2 = "2S 2H 2C 8D JH"; String threeOf1 = "4S AH AS 8C AD"; @@ -171,7 +171,7 @@ public void twoThrees() { @Disabled("Remove to run test") @Test - @DisplayName("Three-of-a-kind tie broken by remaining card") + @DisplayName("with multiple decks, two players can have same three of a kind, ties go to highest remaining cards") public void sameThreesMultipleDecks() { String remainingCard7 = "5S AH AS 7C AD"; String remainingCard8 = "4S AH AS 8C AD"; @@ -181,7 +181,7 @@ public void sameThreesMultipleDecks() { @Disabled("Remove to run test") @Test - @DisplayName("Straight beats three-of-a-kind") + @DisplayName("a straight beats three of a kind") public void threeVsStraight() { String threeOf4 = "4S 5H 4C 8D 4H"; String straight = "3S 4D 2S 6D 5C"; @@ -191,7 +191,7 @@ public void threeVsStraight() { @Disabled("Remove to run test") @Test - @DisplayName("Ace can end a straight (high)") + @DisplayName("aces can end a straight (10 J Q K A)") public void acesCanEndAStraight() { String hand = "4S 5H 4C 8D 4H"; String straightEndsA = "10D JH QS KD AC"; @@ -201,7 +201,7 @@ public void acesCanEndAStraight() { @Disabled("Remove to run test") @Test - @DisplayName("Ace can start a straight (low)") + @DisplayName("aces can start a straight (A 2 3 4 5)") public void acesCanStartAStraight() { String hand = "4S 5H 4C 8D 4H"; String straightStartA = "4D AH 3S 2D 5C"; @@ -211,7 +211,7 @@ public void acesCanStartAStraight() { @Disabled("Remove to run test") @Test - @DisplayName("Ace cannot be in the middle of a straight") + @DisplayName("aces cannot be in the middle of a straight (Q K A 2 3)") public void acesCannotBeInMiddleOfStraight() { String hand = "2C 3D 7H 5H 2S"; String straightMiddleA = "QS KH AC 2D 3S"; @@ -221,7 +221,7 @@ public void acesCannotBeInMiddleOfStraight() { @Disabled("Remove to run test") @Test - @DisplayName("Two straights compared by highest card") + @DisplayName("both hands with a straight, tie goes to highest ranked card") public void twoStraights() { String straightTo8 = "4S 6C 7S 8D 5H"; String straightTo9 = "5S 7H 8S 9D 6H"; @@ -231,7 +231,7 @@ public void twoStraights() { @Disabled("Remove to run test") @Test - @DisplayName("Lowest straight starts with Ace low") + @DisplayName("even though an ace is usually high, a 5-high straight is the lowest-scoring straight") public void theLowestStraightStartsWithAce() { String straight = "2H 3C 4D 5D 6H"; String straightStartA = "4S AH 3S 2D 5H"; @@ -241,7 +241,7 @@ public void theLowestStraightStartsWithAce() { @Disabled("Remove to run test") @Test - @DisplayName("Flush beats straight") + @DisplayName("flush beats a straight") public void straightVsFlush() { String straightTo8 = "4C 6H 7D 8D 5H"; String flushTo7 = "2S 4S 5S 6S 7S"; @@ -251,7 +251,7 @@ public void straightVsFlush() { @Disabled("Remove to run test") @Test - @DisplayName("Compare two flushes") + @DisplayName("both hands have a flush, tie goes to high card, down to the last one if necessary") public void twoFlushs() { String flushTo9 = "2H 7H 8H 9H 6H"; String flushTo7 = "3S 5S 6S 7S 8S"; @@ -261,7 +261,7 @@ public void twoFlushs() { @Disabled("Remove to run test") @Test - @DisplayName("Full house beats flush") + @DisplayName("full house beats a flush") public void flushVsFull() { String flushTo8 = "3H 6H 7H 8H 5H"; String full = "4S 5H 4C 5D 4H"; @@ -271,7 +271,7 @@ public void flushVsFull() { @Disabled("Remove to run test") @Test - @DisplayName("Compare two full houses") + @DisplayName("both hands have a full house, tie goes to highest-ranked triplet") public void twoFulls() { String fullOf4By9 = "4H 4S 4D 9S 9D"; String fullOf5By8 = "5H 5S 5D 8S 8D"; @@ -281,7 +281,7 @@ public void twoFulls() { @Disabled("Remove to run test") @Test - @DisplayName("Full houses with same triplet compared by pair") + @DisplayName("with multiple decks, both hands have a full house with the same triplet, tie goes to the pair") public void twoFullssameThripletMultipleDecks() { String fullOf5By9 = "5H 5S 5D 9S 9D"; String fullOf5By8 = "5H 5S 5D 8S 8D"; @@ -291,7 +291,7 @@ public void twoFullssameThripletMultipleDecks() { @Disabled("Remove to run test") @Test - @DisplayName("Four-of-a-kind beats full house") + @DisplayName("four of a kind beats a full house") public void fullVsSquare() { String full = "4S 5H 4D 5D 4H"; String squareOf3 = "3S 3H 2S 3D 3C"; @@ -301,7 +301,7 @@ public void fullVsSquare() { @Disabled("Remove to run test") @Test - @DisplayName("Compare two four-of-a-kinds") + @DisplayName("both hands have four of a kind, tie goes to high quad") public void twoSquares() { String squareOf2 = "2S 2H 2C 8D 2D"; String squareOf5 = "4S 5H 5S 5D 5C"; @@ -311,7 +311,7 @@ public void twoSquares() { @Disabled("Remove to run test") @Test - @DisplayName("Four-of-a-kind tie broken by kicker") + @DisplayName("with multiple decks, both hands with identical four of a kind, tie determined by kicker") public void sameSquaresMultipleDecks() { String kicker2 = "3S 3H 2S 3D 3C"; String kicker4 = "3S 3H 4S 3D 3C"; @@ -321,7 +321,7 @@ public void sameSquaresMultipleDecks() { @Disabled("Remove to run test") @Test - @DisplayName("Straight flush beats four-of-a-kind") + @DisplayName("straight flush beats four of a kind") public void squareVsStraightFlush() { String squareOf5 = "4S 5H 5S 5D 5C"; String straightFlushTo9 = "7S 8S 9S 6S 10S"; @@ -331,7 +331,7 @@ public void squareVsStraightFlush() { @Disabled("Remove to run test") @Test - @DisplayName("Straight flush ending with Ace is highest") + @DisplayName("aces can end a straight flush (10 J Q K A)") public void acesEndingStraightFlush() { String hand = "KC AH AS AD AC"; String straightFlushEndingWithA = "10C JC QC KC AC"; @@ -341,7 +341,7 @@ public void acesEndingStraightFlush() { @Disabled("Remove to run test") @Test - @DisplayName("Straight flush starting with Ace (low) is allowed") + @DisplayName("aces can start a straight flush (A 2 3 4 5)") public void acesStartingStraightFlush() { String straightFlushStartingWithA = "4H AH 3H 2H 5H"; String hand = "KS AH AS AD AC"; @@ -351,7 +351,7 @@ public void acesStartingStraightFlush() { @Disabled("Remove to run test") @Test - @DisplayName("Ace cannot be in middle of straight flush") + @DisplayName("aces cannot be in the middle of a straight flush (Q K A 2 3)") public void acesCannotBeInMiddleOfStraightFlush() { String straightFlushWithAInMiddle = "QH KH AH 2H 3H"; String hand = "2C AC QC 10C KC"; @@ -361,7 +361,7 @@ public void acesCannotBeInMiddleOfStraightFlush() { @Disabled("Remove to run test") @Test - @DisplayName("Compare two straight flushes by highest card") + @DisplayName("both hands have a straight flush, tie goes to highest-ranked card") public void twoStraightFlushes() { String straightFlushTo8 = "4H 6H 7H 8H 5H"; String straightFlushTo9 = "5S 7S 8S 9S 6S"; @@ -371,7 +371,7 @@ public void twoStraightFlushes() { @Disabled("Remove to run test") @Test - @DisplayName("Lowest straight flush to 5 is ranked lowest") + @DisplayName("even though an ace is usually high, a 5-high straight flush is the lowest-scoring straight flush") public void straightFlushTo5IsTheLowestScoring() { String straightFlushTo6 = "2H 3H 4H 5H 6H"; String straightFlushTo5 = "4D AD 3D 2D 5D"; From a51cf7544865ee4bf00c4f94b55f11c6728bad68 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Sat, 22 Nov 2025 11:25:46 +0530 Subject: [PATCH 16/22] Add suggestion to ErrorHandlingTest --- .../src/test/java/ErrorHandlingTest.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/exercises/practice/error-handling/src/test/java/ErrorHandlingTest.java b/exercises/practice/error-handling/src/test/java/ErrorHandlingTest.java index f74efcb7b..7459b687f 100644 --- a/exercises/practice/error-handling/src/test/java/ErrorHandlingTest.java +++ b/exercises/practice/error-handling/src/test/java/ErrorHandlingTest.java @@ -12,7 +12,7 @@ public class ErrorHandlingTest { private ErrorHandling errorHandling = new ErrorHandling(); @Test - @DisplayName("Throws a general exception when requested") + @DisplayName("Throws IllegalArgumentException") public void testThrowIllegalArgumentException() { assertThatExceptionOfType(Exception.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingIllegalArgumentException()); @@ -30,7 +30,7 @@ public void testThrowIllegalArgumentExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test - @DisplayName("Throws a checked exception (not a RuntimeException)") + @DisplayName("Throws any checked exception") public void testThrowAnyCheckedException() { assertThatExceptionOfType(Exception.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingAnyCheckedException()) @@ -39,7 +39,7 @@ public void testThrowAnyCheckedException() { @Disabled("Remove to run test") @Test - @DisplayName("Throws a checked exception with the provided detail message") + @DisplayName("Throws any checked exception with provided detail message") public void testThrowAnyCheckedExceptionWithDetailMessage() { assertThatExceptionOfType(Exception.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingAnyCheckedExceptionWithDetailMessage( @@ -50,7 +50,7 @@ public void testThrowAnyCheckedExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test - @DisplayName("Throws an unchecked RuntimeException when requested") + @DisplayName("Throws any unchecked exception") public void testThrowAnyUncheckedException() { assertThatExceptionOfType(RuntimeException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingAnyUncheckedException()); @@ -58,7 +58,7 @@ public void testThrowAnyUncheckedException() { @Disabled("Remove to run test") @Test - @DisplayName("Throws an unchecked RuntimeException with provided detail message") + @DisplayName("Throws any unchecked exception with provided detail message") public void testThrowAnyUncheckedExceptionWithDetailMessage() { assertThatExceptionOfType(RuntimeException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingAnyUncheckedExceptionWithDetailMessage( @@ -68,7 +68,7 @@ public void testThrowAnyUncheckedExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test - @DisplayName("Throws a custom checked exception") + @DisplayName("Throws custom checked exception") public void testThrowCustomCheckedException() { assertThatExceptionOfType(CustomCheckedException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingCustomCheckedException()); @@ -76,7 +76,7 @@ public void testThrowCustomCheckedException() { @Disabled("Remove to run test") @Test - @DisplayName("Throws a custom checked exception with provided message") + @DisplayName("Throws custom checked exception with provided detail message") public void testThrowCustomCheckedExceptionWithDetailMessage() { assertThatExceptionOfType(CustomCheckedException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingCustomCheckedExceptionWithDetailMessage( @@ -86,7 +86,7 @@ public void testThrowCustomCheckedExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test - @DisplayName("Throws a custom unchecked exception") + @DisplayName("Throws custom unchecked exception") public void testThrowCustomUncheckedException() { assertThatExceptionOfType(CustomUncheckedException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingCustomUncheckedException()); @@ -94,7 +94,7 @@ public void testThrowCustomUncheckedException() { @Disabled("Remove to run test") @Test - @DisplayName("Throws a custom unchecked exception with provided message") + @DisplayName("Throws custom unchecked exception with provided detail message") public void testThrowCustomUncheckedExceptionWithDetailMessage() { assertThatExceptionOfType(CustomUncheckedException.class) .isThrownBy(() -> errorHandling.handleErrorByThrowingCustomUncheckedExceptionWithDetailMessage( @@ -104,7 +104,7 @@ public void testThrowCustomUncheckedExceptionWithDetailMessage() { @Disabled("Remove to run test") @Test - @DisplayName("Returns Optional for valid input and empty Optional for invalid input") + @DisplayName("Handles error by throwing Optional instance") public void testReturnOptionalInstance() { Optional successfulResult = errorHandling.handleErrorByReturningOptionalInstance("1"); assertThat(successfulResult).isPresent().hasValue(1); From 5f39489ed8c3dc3e03738cdee9bc1b920bf0c07d Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Sat, 22 Nov 2025 11:26:04 +0530 Subject: [PATCH 17/22] Add suggestion to HangmanTest --- exercises/practice/hangman/src/test/java/HangmanTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/practice/hangman/src/test/java/HangmanTest.java b/exercises/practice/hangman/src/test/java/HangmanTest.java index 039ce7ed3..d4bbe13da 100644 --- a/exercises/practice/hangman/src/test/java/HangmanTest.java +++ b/exercises/practice/hangman/src/test/java/HangmanTest.java @@ -24,7 +24,7 @@ public void init() { } @Test - @DisplayName("Initial game state is set correctly for a new word") + @DisplayName("Initial game state is set correctly") public void initialization() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -90,7 +90,7 @@ public void gameInProgress() { @Disabled("Remove to run test") @Test - @DisplayName("Winning the game reveals full word and marks WIN status") + @DisplayName("Winning the game results in WIN status") public void wonGame() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -104,7 +104,7 @@ public void wonGame() { @Disabled("Remove to run test") @Test - @DisplayName("Losing the game results in LOSS status and all parts present") + @DisplayName("Losing the game results in LOSS status") public void lostGame() { Observable result = hangman.play( Observable.fromArray("secret"), @@ -198,7 +198,7 @@ Observable createLetterObservable(ObservableEmitter[] emitters, Runnable emit) { @Disabled("Remove to run test") @Test - @DisplayName("Cannot play the same correct guess twice") + @DisplayName("Cannot play the same guess twice") public void cannotPlayAGuessTwice() { Observable result = hangman.play( Observable.fromArray("secret"), From 44618f2f704328bf8f87edf209d2ac355e6ec38f Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Sat, 22 Nov 2025 11:26:15 +0530 Subject: [PATCH 18/22] Add suggestion to MazeGeneratorTest --- .../src/test/java/MazeGeneratorTest.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java b/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java index ed2a3c89e..dfec2f06f 100644 --- a/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java +++ b/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java @@ -38,7 +38,7 @@ public void setup() { } @Test - @DisplayName("Generated maze has correct overall dimensions") + @DisplayName("Maze has correct overall dimensions") public void theDimensionsOfTheMazeAreCorrect() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); var expectedWidth = RECTANGLE_COLUMNS * 2 + 1; @@ -51,7 +51,7 @@ public void theDimensionsOfTheMazeAreCorrect() { @Disabled("Remove to run test") @Test - @DisplayName("Maze contains only allowed characters") + @DisplayName("Maze contains only valid characters") public void theMazeContainsOnlyValidCharacters() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); @@ -67,7 +67,7 @@ public void theMazeContainsOnlyValidCharacters() { @Disabled("Remove to run test") @Test @DisplayName("Maze has a single entrance on the left side") - public void theMazeHasOnlyOneEntranceOnTheLeftSide() { + public void theMazeHasSingleEntranceOnTheLeftSide() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); int entranceCount = countEntrances(maze); @@ -79,7 +79,7 @@ public void theMazeHasOnlyOneEntranceOnTheLeftSide() { @Disabled("Remove to run test") @Test @DisplayName("Maze has a single exit on the right side") - public void theMazeHasSingleExitOnTheRightSideOfTheMaze() { + public void theMazeHasSingleExitOnTheRightSide() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); int exitCount = countExits(maze); @@ -90,7 +90,7 @@ public void theMazeHasSingleExitOnTheRightSideOfTheMaze() { @Disabled("Remove to run test") @Test - @DisplayName("Consecutive maze generations produce different mazes") + @DisplayName("Maze is different each time it is generated") public void aMazeIsDifferentEachTimeItIsGenerated() { var maze1 = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); var maze2 = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); @@ -126,7 +126,7 @@ public void twoMazesWithDifferentSeedsShouldNotBeEqual() { @Disabled("Remove to run test") @Test - @DisplayName("Generated maze is perfect (single path, no isolated cells)") + @DisplayName("Maze is generated perfectly (single path, no isolated cells)") public void theMazeIsPerfect() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); @@ -136,7 +136,7 @@ public void theMazeIsPerfect() { @Disabled("Remove to run test") @Test - @DisplayName("Generated maze with seed is perfect (single path, no isolated cells)") + @DisplayName("Maze with a seed is generated perfectly (single path, no isolated cells)") public void theMazeIsPerfectWithSeed() { var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS, SEED_ONE); @@ -146,7 +146,7 @@ public void theMazeIsPerfectWithSeed() { @Disabled("Remove to run test") @Test - @DisplayName("Throws when rows less than minimum allowed") + @DisplayName("Throws when rows are less than five") public void shouldThrowExceptionWhenRowsIsLessThanFive() { assertThatIllegalArgumentException() .isThrownBy(() -> sut.generatePerfectMaze(0, RECTANGLE_COLUMNS)); @@ -154,7 +154,7 @@ public void shouldThrowExceptionWhenRowsIsLessThanFive() { @Disabled("Remove to run test") @Test - @DisplayName("Throws when columns less than minimum allowed") + @DisplayName("Throws when columns are less than five") public void shouldThrowExceptionWhenColumnsIsLessThanFive() { assertThatIllegalArgumentException() .isThrownBy(() -> sut.generatePerfectMaze(RECTANGLE_ROWS, 0)); @@ -162,7 +162,7 @@ public void shouldThrowExceptionWhenColumnsIsLessThanFive() { @Disabled("Remove to run test") @Test - @DisplayName("Throws when rows exceed maximum allowed") + @DisplayName("Throws when rows exceed hundred") public void shouldThrowExceptionWhenRowsIsMoreThenHundred() { assertThatIllegalArgumentException() .isThrownBy(() -> sut.generatePerfectMaze(101, RECTANGLE_COLUMNS)); @@ -170,7 +170,7 @@ public void shouldThrowExceptionWhenRowsIsMoreThenHundred() { @Disabled("Remove to run test") @Test - @DisplayName("Throws when columns exceed maximum allowed") + @DisplayName("Throws when columns exceed hundred") public void shouldThrowExceptionWhenColumnsIsMoreThenHundred() { assertThatIllegalArgumentException() .isThrownBy(() -> sut.generatePerfectMaze(RECTANGLE_ROWS, 101)); From 37981c3e8be71d4697f388bdb7cf0a489cbc5b26 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Sat, 22 Nov 2025 11:26:29 +0530 Subject: [PATCH 19/22] Add suggestion to ParallelLetterFrequencyTest --- .../java/ParallelLetterFrequencyTest.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java b/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java index c26c07c09..cce168b52 100644 --- a/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java +++ b/exercises/practice/parallel-letter-frequency/src/test/java/ParallelLetterFrequencyTest.java @@ -381,24 +381,6 @@ public void testCombinationOfLowerAndUppercaseLettersPunctuationAndWhiteSpace() assertThat(p.countLetters()).isEqualTo(expectedOutput); } - - @Disabled("Remove to run test") - @Test - @DisplayName("many small texts") - public void testManySmallTexts() { - String[] input = new String[50]; - Arrays.fill(input, "abbccc"); - Map expectedOutput = new HashMap<>() { - { - put('a', 50); - put('b', 100); - put('c', 150); - } - }; - ParallelLetterFrequency p = new ParallelLetterFrequency(input); - - assertThat(p.countLetters()).isEqualTo(expectedOutput); - } @Disabled("Remove to run test") @Test @@ -437,6 +419,24 @@ public void testLargeTexts() { ParallelLetterFrequency p = new ParallelLetterFrequency(input); assertThat(p.countLetters()).isEqualTo(expectedOutput); - } + } + + @Disabled("Remove to run test") + @Test + @DisplayName("many small texts") + public void testManySmallTexts() { + String[] input = new String[50]; + Arrays.fill(input, "abbccc"); + Map expectedOutput = new HashMap<>() { + { + put('a', 50); + put('b', 100); + put('c', 150); + } + }; + ParallelLetterFrequency p = new ParallelLetterFrequency(input); + + assertThat(p.countLetters()).isEqualTo(expectedOutput); + } } From 6db2931f67ba546a343d12cb1e7ecc0d02c0b36a Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Sat, 22 Nov 2025 11:26:39 +0530 Subject: [PATCH 20/22] Add suggestion to RobotTest --- exercises/practice/robot-name/src/test/java/RobotTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/practice/robot-name/src/test/java/RobotTest.java b/exercises/practice/robot-name/src/test/java/RobotTest.java index 26d1f1520..542d4a586 100644 --- a/exercises/practice/robot-name/src/test/java/RobotTest.java +++ b/exercises/practice/robot-name/src/test/java/RobotTest.java @@ -19,7 +19,7 @@ public void setUp() { } @Test - @DisplayName("Robot has a valid name matching the pattern") + @DisplayName("Robot has a valid name") public void hasName() { assertIsValidName(robot.getName()); } @@ -51,7 +51,7 @@ public void resetName() { @Disabled("Remove to run test") @Test - @DisplayName("Robot names are unique in a large sample") + @DisplayName("Robot names are unique") public void robotNamesAreUnique() { Set robotNames = new HashSet<>(); int sampleSize = 5000; From 9805feca0fb0a5568f78941cb7f320c80d67e379 Mon Sep 17 00:00:00 2001 From: sudipmanjarekar Date: Sat, 22 Nov 2025 11:26:48 +0530 Subject: [PATCH 21/22] Add suggestion to SimpleLinkedListTest --- .../src/test/java/SimpleLinkedListTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/practice/simple-linked-list/src/test/java/SimpleLinkedListTest.java b/exercises/practice/simple-linked-list/src/test/java/SimpleLinkedListTest.java index 6c047de92..109d3b3a7 100644 --- a/exercises/practice/simple-linked-list/src/test/java/SimpleLinkedListTest.java +++ b/exercises/practice/simple-linked-list/src/test/java/SimpleLinkedListTest.java @@ -10,7 +10,7 @@ public class SimpleLinkedListTest { @Test - @DisplayName("A new list is empty with size zero") + @DisplayName("A new list is empty") public void aNewListIsEmpty() { SimpleLinkedList list = new SimpleLinkedList<>(); assertThat(list.size()).isEqualTo(0); @@ -18,7 +18,7 @@ public void aNewListIsEmpty() { @Disabled("Remove to run test") @Test - @DisplayName("Create list from array sets correct size") + @DisplayName("Create list from array") public void canCreateFromArray() { Character[] values = new Character[]{'1', '2', '3'}; SimpleLinkedList list = new SimpleLinkedList(values); @@ -67,7 +67,7 @@ public void reverseReversesList() { @Disabled("Remove to run test") @Test - @DisplayName("Convert list to array returns correct element order") + @DisplayName("Can return list as an array") public void canReturnListAsArray() { SimpleLinkedList list = new SimpleLinkedList(); list.push('9'); @@ -81,7 +81,7 @@ public void canReturnListAsArray() { @Disabled("Remove to run test") @Test - @DisplayName("Empty list as array returns empty array") + @DisplayName("Can return empty list as an empty array") public void canReturnEmptyListAsEmptyArray() { SimpleLinkedList list = new SimpleLinkedList(); Object[] expected = {}; From 40302ea4f7a5fa19bf3afbe436bef8cbce8d8ef0 Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Sun, 23 Nov 2025 21:29:06 +0530 Subject: [PATCH 22/22] Changing orders of tests to keep similar tests together --- .../src/test/java/MazeGeneratorTest.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java b/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java index dfec2f06f..8b3635f2a 100644 --- a/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java +++ b/exercises/practice/mazy-mice/src/test/java/MazeGeneratorTest.java @@ -100,6 +100,26 @@ public void aMazeIsDifferentEachTimeItIsGenerated() { .isNotEqualTo(maze2); } + @Disabled("Remove to run test") + @Test + @DisplayName("Maze is generated perfectly (single path, no isolated cells)") + public void theMazeIsPerfect() { + var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); + + assertThatMazeHasSinglePath(maze); + assertThatMazeHasNoIsolatedSections(maze); + } + + @Disabled("Remove to run test") + @Test + @DisplayName("Maze with a seed is generated perfectly (single path, no isolated cells)") + public void theMazeIsPerfectWithSeed() { + var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS, SEED_ONE); + + assertThatMazeHasSinglePath(maze); + assertThatMazeHasNoIsolatedSections(maze); + } + @Disabled("Remove to run test") @Test @DisplayName("Mazes generated with same seed are identical") @@ -124,26 +144,6 @@ public void twoMazesWithDifferentSeedsShouldNotBeEqual() { .isNotEqualTo(maze2); } - @Disabled("Remove to run test") - @Test - @DisplayName("Maze is generated perfectly (single path, no isolated cells)") - public void theMazeIsPerfect() { - var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS); - - assertThatMazeHasSinglePath(maze); - assertThatMazeHasNoIsolatedSections(maze); - } - - @Disabled("Remove to run test") - @Test - @DisplayName("Maze with a seed is generated perfectly (single path, no isolated cells)") - public void theMazeIsPerfectWithSeed() { - var maze = sut.generatePerfectMaze(RECTANGLE_ROWS, RECTANGLE_COLUMNS, SEED_ONE); - - assertThatMazeHasSinglePath(maze); - assertThatMazeHasNoIsolatedSections(maze); - } - @Disabled("Remove to run test") @Test @DisplayName("Throws when rows are less than five")