diff --git a/exercises/practice/sublist/src/test/java/RelationshipComputerTest.java b/exercises/practice/sublist/src/test/java/RelationshipComputerTest.java index e9e4adc62..bcb2d6f8d 100644 --- a/exercises/practice/sublist/src/test/java/RelationshipComputerTest.java +++ b/exercises/practice/sublist/src/test/java/RelationshipComputerTest.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,6 +11,7 @@ public class RelationshipComputerTest { @Test + @DisplayName("empty lists") public void testThatTwoEmptyListsAreConsideredEqual() { Relationship relationship = new RelationshipComputer<>().computeRelationship( emptyList(), @@ -20,6 +22,7 @@ public void testThatTwoEmptyListsAreConsideredEqual() { @Disabled("Remove to run test") @Test + @DisplayName("empty list within non empty list") public void testEmptyListIsSublistOfNonEmptyList() { Relationship relationship = new RelationshipComputer<>().computeRelationship( emptyList(), @@ -30,6 +33,7 @@ public void testEmptyListIsSublistOfNonEmptyList() { @Disabled("Remove to run test") @Test + @DisplayName("non empty list contains empty list") public void testNonEmptyListIsSuperlistOfEmptyList() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList('1', '2', '3'), @@ -40,6 +44,7 @@ public void testNonEmptyListIsSuperlistOfEmptyList() { @Disabled("Remove to run test") @Test + @DisplayName("list equals itself") public void testListIsEqualToItself() { List anyList = asList("1", "2", "3"); @@ -52,6 +57,7 @@ public void testListIsEqualToItself() { @Disabled("Remove to run test") @Test + @DisplayName("different lists") public void testDifferentListsOfTheSameLengthAreUnequal() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList(1, 2, 3), @@ -62,6 +68,7 @@ public void testDifferentListsOfTheSameLengthAreUnequal() { @Disabled("Remove to run test") @Test + @DisplayName("false start") public void testSublistCheckDoesNotAbortAfterFalseStart() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList('1', '2', '5'), @@ -72,6 +79,7 @@ public void testSublistCheckDoesNotAbortAfterFalseStart() { @Disabled("Remove to run test") @Test + @DisplayName("consecutive") public void testSublistCheckHandlesExtraneousRepeatsOfFirstEntry() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList("1", "1", "2"), @@ -82,6 +90,7 @@ public void testSublistCheckHandlesExtraneousRepeatsOfFirstEntry() { @Disabled("Remove to run test") @Test + @DisplayName("sublist at start") public void testSublistAtStart() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList(0, 1, 2), @@ -92,6 +101,7 @@ public void testSublistAtStart() { @Disabled("Remove to run test") @Test + @DisplayName("sublist in middle") public void testSublistInMiddle() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList('2', '3', '4'), @@ -102,6 +112,7 @@ public void testSublistInMiddle() { @Disabled("Remove to run test") @Test + @DisplayName("sublist at end") public void testSublistAtEnd() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList("3", "4", "5"), @@ -112,6 +123,7 @@ public void testSublistAtEnd() { @Disabled("Remove to run test") @Test + @DisplayName("at start of superlist") public void testAtStartOfSuperlist() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList(0, 1, 2, 3, 4, 5), @@ -122,6 +134,7 @@ public void testAtStartOfSuperlist() { @Disabled("Remove to run test") @Test + @DisplayName("in middle of superlist") public void testInMiddleOfSuperlist() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList('0', '1', '2', '3', '4', '5'), @@ -132,6 +145,7 @@ public void testInMiddleOfSuperlist() { @Disabled("Remove to run test") @Test + @DisplayName("at end of superlist") public void testAtEndOfSuperlist() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList("0", "1", "2", "3", "4", "5"), @@ -142,6 +156,7 @@ public void testAtEndOfSuperlist() { @Disabled("Remove to run test") @Test + @DisplayName("first list missing element from second list") public void testFirstListMissingElementFromSecondList() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList(1, 3), @@ -152,6 +167,7 @@ public void testFirstListMissingElementFromSecondList() { @Disabled("Remove to run test") @Test + @DisplayName("second list missing element from first list") public void testSecondListMissingElementFromFirstList() { Relationship relationship = new RelationshipComputer<>().computeRelationship( asList('1', '2', '3'), @@ -162,30 +178,33 @@ public void testSecondListMissingElementFromFirstList() { @Disabled("Remove to run test") @Test - public void testThatListOrderingIsAccountedFor() { + @DisplayName("first list missing additional digits from second list") + public void testFirstListMissingAdditionalDigitsFromSecondList() { Relationship relationship = new RelationshipComputer<>().computeRelationship( - asList("1", "2", "3"), - asList("3", "2", "1")); + asList(1, 2), + asList(1, 22)); assertThat(relationship).isEqualTo(Relationship.UNEQUAL); } @Disabled("Remove to run test") @Test - public void testThatListsWithSameDigitsButDifferentNumbersAreUnequal() { + @DisplayName("order matters to a list") + public void testThatListOrderingIsAccountedFor() { Relationship relationship = new RelationshipComputer<>().computeRelationship( - asList(1, 0, 1), - asList(10, 1)); + asList("1", "2", "3"), + asList("3", "2", "1")); assertThat(relationship).isEqualTo(Relationship.UNEQUAL); } @Disabled("Remove to run test") @Test - public void testFirstListMissingAdditionalDigitsFromSecondList() { + @DisplayName("same digits but different numbers") + public void testThatListsWithSameDigitsButDifferentNumbersAreUnequal() { Relationship relationship = new RelationshipComputer<>().computeRelationship( - asList(1, 2), - asList(1, 22)); + asList(1, 0, 1), + asList(10, 1)); assertThat(relationship).isEqualTo(Relationship.UNEQUAL); } diff --git a/exercises/practice/sum-of-multiples/src/test/java/SumOfMultiplesTest.java b/exercises/practice/sum-of-multiples/src/test/java/SumOfMultiplesTest.java index c7f7ddfbc..b2736d8bd 100644 --- a/exercises/practice/sum-of-multiples/src/test/java/SumOfMultiplesTest.java +++ b/exercises/practice/sum-of-multiples/src/test/java/SumOfMultiplesTest.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 SumOfMultiplesTest { @Test + @DisplayName("no multiples within limit") public void testNoMultiplesWithinLimit() { int[] set = { @@ -19,6 +21,7 @@ public void testNoMultiplesWithinLimit() { @Disabled("Remove to run test") @Test + @DisplayName("one factor has multiples within limit") public void testOneFactorHasMultiplesWithinLimit() { int[] set = { @@ -32,6 +35,7 @@ public void testOneFactorHasMultiplesWithinLimit() { @Disabled("Remove to run test") @Test + @DisplayName("more than one multiple within limit") public void testMoreThanOneMultipleWithinLimit() { int[] set = { @@ -44,6 +48,7 @@ public void testMoreThanOneMultipleWithinLimit() { @Disabled("Remove to run test") @Test + @DisplayName("more than one factor with multiples within limit") public void testMoreThanOneFactorWithMultiplesWithinLimit() { int[] set = { @@ -57,6 +62,7 @@ public void testMoreThanOneFactorWithMultiplesWithinLimit() { @Disabled("Remove to run test") @Test + @DisplayName("each multiple is only counted once") public void testEachMultipleIsOnlyCountedOnce() { int[] set = { @@ -70,6 +76,7 @@ public void testEachMultipleIsOnlyCountedOnce() { @Disabled("Remove to run test") @Test + @DisplayName("a much larger limit") public void testAMuchLargerLimit() { int[] set = { @@ -83,6 +90,7 @@ public void testAMuchLargerLimit() { @Disabled("Remove to run test") @Test + @DisplayName("three factors") public void testThreeFactors() { int[] set = { @@ -97,6 +105,7 @@ public void testThreeFactors() { @Disabled("Remove to run test") @Test + @DisplayName("factors not relatively prime") public void testFactorsNotRelativelyPrime() { int[] set = { @@ -110,6 +119,7 @@ public void testFactorsNotRelativelyPrime() { @Disabled("Remove to run test") @Test + @DisplayName("some pairs of factors relatively prime and some not") public void testSomePairsOfFactorsRelativelyPrimeAndSomeNot() { int[] set = { @@ -124,6 +134,7 @@ public void testSomePairsOfFactorsRelativelyPrimeAndSomeNot() { @Disabled("Remove to run test") @Test + @DisplayName("one factor is a multiple of another") public void testOneFactorIsAMultipleOfAnother() { int[] set = { @@ -137,6 +148,7 @@ public void testOneFactorIsAMultipleOfAnother() { @Disabled("Remove to run test") @Test + @DisplayName("much larger factors") public void testMuchLargerFactors() { int[] set = { @@ -150,6 +162,7 @@ public void testMuchLargerFactors() { @Disabled("Remove to run test") @Test + @DisplayName("all numbers are multiples of 1") public void testAllNumbersAreMultiplesOf1() { int[] set = { @@ -162,6 +175,7 @@ public void testAllNumbersAreMultiplesOf1() { @Disabled("Remove to run test") @Test + @DisplayName("no factors means an empty sum") public void testNoFactorsMeanAnEmptySum() { int[] set = {}; @@ -172,6 +186,7 @@ public void testNoFactorsMeanAnEmptySum() { @Disabled("Remove to run test") @Test + @DisplayName("the only multiple of 0 is 0") public void testSumOfMultiplesOfZeroIsZero() { int[] set = { @@ -184,6 +199,7 @@ public void testSumOfMultiplesOfZeroIsZero() { @Disabled("Remove to run test") @Test + @DisplayName("the factor 0 does not affect the sum of multiples of other factors") public void testFactorZeroDoesNotAffectTheSumOfMultiplesOfOtherFactors() { int[] set = { @@ -197,6 +213,7 @@ public void testFactorZeroDoesNotAffectTheSumOfMultiplesOfOtherFactors() { @Disabled("Remove to run test") @Test + @DisplayName("solutions using include-exclude must extend to cardinality greater than 3") public void testSolutionsUsingIncludeExcludeMustExtendToCardinalityGreater3() { int[] set = { diff --git a/exercises/practice/two-fer/src/test/java/TwoferTest.java b/exercises/practice/two-fer/src/test/java/TwoferTest.java index 67dd68646..3993057d6 100644 --- a/exercises/practice/two-fer/src/test/java/TwoferTest.java +++ b/exercises/practice/two-fer/src/test/java/TwoferTest.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("no name given") public void noNameGiven() { assertThat(twofer.twofer(null)) .isEqualTo("One for you, one for me."); @@ -21,6 +23,7 @@ public void noNameGiven() { @Disabled("Remove to run test") @Test + @DisplayName("a name given") public void aNameGiven() { assertThat(twofer.twofer("Alice")) .isEqualTo("One for Alice, one for me."); @@ -28,6 +31,7 @@ public void aNameGiven() { @Disabled("Remove to run test") @Test + @DisplayName("another name given") public void anotherNameGiven() { assertThat(twofer.twofer("Bob")) .isEqualTo("One for Bob, one for me."); diff --git a/exercises/practice/word-count/src/test/java/WordCountTest.java b/exercises/practice/word-count/src/test/java/WordCountTest.java index bd5f70fdb..0c2cd4e01 100644 --- a/exercises/practice/word-count/src/test/java/WordCountTest.java +++ b/exercises/practice/word-count/src/test/java/WordCountTest.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.HashMap; @@ -21,6 +22,7 @@ public void setup() { @Test + @DisplayName("count one word") public void countOneWord() { expectedWordCount.put("word", 1); @@ -30,6 +32,7 @@ public void countOneWord() { @Disabled("Remove to run test") @Test + @DisplayName("count one of each word") public void countOneOfEachWord() { expectedWordCount.put("one", 1); expectedWordCount.put("of", 1); @@ -41,6 +44,7 @@ public void countOneOfEachWord() { @Disabled("Remove to run test") @Test + @DisplayName("multiple occurrences of a word") public void multipleOccurrencesOfAWord() { expectedWordCount.put("one", 1); expectedWordCount.put("fish", 4); @@ -54,6 +58,7 @@ public void multipleOccurrencesOfAWord() { @Disabled("Remove to run test") @Test + @DisplayName("handles cramped lists") public void handlesCrampedLists() { expectedWordCount.put("one", 1); expectedWordCount.put("two", 1); @@ -65,6 +70,7 @@ public void handlesCrampedLists() { @Disabled("Remove to run test") @Test + @DisplayName("handles expanded lists") public void handlesExpandedLists() { expectedWordCount.put("one", 1); expectedWordCount.put("two", 1); @@ -76,6 +82,7 @@ public void handlesExpandedLists() { @Disabled("Remove to run test") @Test + @DisplayName("ignore punctuation") public void ignorePunctuation() { expectedWordCount.put("car", 1); expectedWordCount.put("carpet", 1); @@ -90,6 +97,7 @@ public void ignorePunctuation() { @Disabled("Remove to run test") @Test + @DisplayName("include numbers") public void includeNumbers() { expectedWordCount.put("testing", 2); expectedWordCount.put("1", 1); @@ -101,6 +109,7 @@ public void includeNumbers() { @Disabled("Remove to run test") @Test + @DisplayName("normalize case") public void normalizeCase() { expectedWordCount.put("go", 3); expectedWordCount.put("stop", 2); @@ -111,6 +120,7 @@ public void normalizeCase() { @Disabled("Remove to run test") @Test + @DisplayName("with apostrophes") public void withApostrophes() { expectedWordCount.put("first", 1); expectedWordCount.put("don't", 2); @@ -127,36 +137,39 @@ public void withApostrophes() { @Disabled("Remove to run test") @Test - public void substringsFromTheBeginning() { + @DisplayName("with quotations") + public void withQuotations() { expectedWordCount.put("joe", 1); expectedWordCount.put("can't", 1); expectedWordCount.put("tell", 1); expectedWordCount.put("between", 1); - expectedWordCount.put("app", 1); - expectedWordCount.put("apple", 1); + expectedWordCount.put("large", 2); expectedWordCount.put("and", 1); - expectedWordCount.put("a", 1); - actualWordCount = wordCount.phrase("Joe can't tell between app, apple and a."); + actualWordCount = wordCount.phrase("Joe can't tell between 'large' and large."); assertThat(actualWordCount).isEqualTo(expectedWordCount); } @Disabled("Remove to run test") @Test - public void withQuotations() { + @DisplayName("substrings from the beginning") + public void substringsFromTheBeginning() { expectedWordCount.put("joe", 1); expectedWordCount.put("can't", 1); expectedWordCount.put("tell", 1); expectedWordCount.put("between", 1); - expectedWordCount.put("large", 2); + expectedWordCount.put("app", 1); + expectedWordCount.put("apple", 1); expectedWordCount.put("and", 1); + expectedWordCount.put("a", 1); - actualWordCount = wordCount.phrase("Joe can't tell between 'large' and large."); + actualWordCount = wordCount.phrase("Joe can't tell between app, apple and a."); assertThat(actualWordCount).isEqualTo(expectedWordCount); } @Disabled("Remove to run test") @Test + @DisplayName("multiple spaces not detected as a word") public void multipleSpacesNotDetectedAsAWord() { expectedWordCount.put("multiple", 1); expectedWordCount.put("whitespaces", 1); @@ -167,6 +180,7 @@ public void multipleSpacesNotDetectedAsAWord() { @Disabled("Remove to run test") @Test + @DisplayName("alternating word separators not detected as a word") public void alternatingWordSeperatorsNotDetectedAsAWord() { expectedWordCount.put("one", 1); expectedWordCount.put("two", 1); @@ -178,6 +192,7 @@ public void alternatingWordSeperatorsNotDetectedAsAWord() { @Disabled("Remove to run test") @Test + @DisplayName("quotation for word with apostrophe") public void quotationForWordWithApostrophe() { expectedWordCount.put("can", 1); expectedWordCount.put("can't", 2); diff --git a/exercises/practice/word-search/src/test/java/WordSearcherTest.java b/exercises/practice/word-search/src/test/java/WordSearcherTest.java index 8460366c5..3a7d9291e 100644 --- a/exercises/practice/word-search/src/test/java/WordSearcherTest.java +++ b/exercises/practice/word-search/src/test/java/WordSearcherTest.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.HashMap; @@ -19,6 +20,7 @@ public void setUp() { } @Test + @DisplayName("Should accept an initial game grid and a target search word") public void testAcceptsInitialGridAndTargetWord() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.empty()); @@ -37,6 +39,7 @@ public void testAcceptsInitialGridAndTargetWord() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate one word written left to right") public void testLocatesOneWordWrittenLeftToRight() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 1), new Pair(7, 1)))); @@ -55,6 +58,7 @@ public void testLocatesOneWordWrittenLeftToRight() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate the same word written left to right in a different position") public void testShouldLocateTheSameWordLeftToRightInDifferentPosition() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(3, 1), new Pair(9, 1)))); @@ -73,6 +77,7 @@ public void testShouldLocateTheSameWordLeftToRightInDifferentPosition() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate a different left to right word") public void testShouldLocateADifferentLeftToRightWord() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("coffee", Optional.of(new WordLocation(new Pair(1, 1), new Pair(6, 1)))); @@ -91,6 +96,7 @@ public void testShouldLocateADifferentLeftToRightWord() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate that different left to right word in a different position") public void testShouldLocateThatDifferentLeftToRightWordInADifferentPosition() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("coffee", Optional.of(new WordLocation(new Pair(2, 1), new Pair(7, 1)))); @@ -109,6 +115,7 @@ public void testShouldLocateThatDifferentLeftToRightWordInADifferentPosition() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate a left to right word in two line grid") public void testShouldLocateLeftToRightWordInTwoLineGrid() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(2, 2), new Pair(8, 2)))); @@ -128,6 +135,7 @@ public void testShouldLocateLeftToRightWordInTwoLineGrid() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate a left to right word in three line grid") public void testShouldLocateLeftToRightWordInThreeLineGrid() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 3), new Pair(7, 3)))); @@ -148,6 +156,7 @@ public void testShouldLocateLeftToRightWordInThreeLineGrid() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate a left to right word in ten line grid") public void testLocatesWordWrittenLeftToRightInTenLineGrid() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); @@ -175,6 +184,7 @@ public void testLocatesWordWrittenLeftToRightInTenLineGrid() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate that left to right word in a different position in a ten line grid") public void testLocatesSameWordWrittenLeftToRightInDifferentTenLineGrid() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 9), new Pair(7, 9)))); @@ -202,6 +212,7 @@ public void testLocatesSameWordWrittenLeftToRightInDifferentTenLineGrid() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate a different left to right word in a ten line grid") public void testLocatesDifferentWordWrittenLeftToRightInTenLineGrid() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("fortran", Optional.of(new WordLocation(new Pair(1, 7), new Pair(7, 7)))); @@ -229,6 +240,7 @@ public void testLocatesDifferentWordWrittenLeftToRightInTenLineGrid() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate multiple words") public void testShouldLocateMultipleWords() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("fortran", Optional.of(new WordLocation(new Pair(1, 7), new Pair(7, 7)))); @@ -257,6 +269,7 @@ public void testShouldLocateMultipleWords() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate a single word written right to left") public void testShouldLocateASingleWordRightToLeft() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("elixir", Optional.of(new WordLocation(new Pair(6, 1), new Pair(1, 1)))); @@ -275,6 +288,7 @@ public void testShouldLocateASingleWordRightToLeft() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate multiple words written in different horizontal directions") public void testShouldLocateMultipleWordsWrittenInDifferentHorizontalDirections() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("elixir", Optional.of(new WordLocation(new Pair(6, 5), new Pair(1, 5)))); @@ -303,6 +317,7 @@ public void testShouldLocateMultipleWordsWrittenInDifferentHorizontalDirections( @Disabled("Remove to run test") @Test + @DisplayName("Should locate words written top to bottom") public void testLocatesWordsWrittenTopToBottom() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); @@ -332,6 +347,7 @@ public void testLocatesWordsWrittenTopToBottom() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate words written bottom to top") public void testLocatesWordsWrittenBottomToTop() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); @@ -360,6 +376,7 @@ public void testLocatesWordsWrittenBottomToTop() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate words written top left to bottom right") public void testLocatesWordsWrittenTopLeftToBottomRight() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); @@ -389,6 +406,7 @@ public void testLocatesWordsWrittenTopLeftToBottomRight() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate words written bottom right to top left") public void testLocatesWordsWrittenBottomRightToTopLeft() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); @@ -419,6 +437,7 @@ public void testLocatesWordsWrittenBottomRightToTopLeft() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate words written bottom left to top right") public void testLocatesWordsWrittenBottomLeftToTopRight() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); @@ -450,6 +469,7 @@ public void testLocatesWordsWrittenBottomLeftToTopRight() { @Disabled("Remove to run test") @Test + @DisplayName("Should locate words written top right to bottom left") public void testLocatesWordsWrittenTopRightToBottomLeft() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); @@ -482,6 +502,7 @@ public void testLocatesWordsWrittenTopRightToBottomLeft() { @Disabled("Remove to run test") @Test + @DisplayName("Should fail to locate a word that is not in the puzzle") public void testFailsToLocateAWordsThatIsNotInThePuzzle() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); @@ -515,6 +536,7 @@ public void testFailsToLocateAWordsThatIsNotInThePuzzle() { @Disabled("Remove to run test") @Test + @DisplayName("Should fail to locate words that are not on horizontal, vertical, or diagonal lines") public void testFailToLocateWordsThatAreNotOnHorizontalVerticalOrDiagonalLines() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("aef", Optional.empty()); @@ -535,6 +557,7 @@ public void testFailToLocateWordsThatAreNotOnHorizontalVerticalOrDiagonalLines() @Disabled("Remove to run test") @Test + @DisplayName("Should not concatenate different lines to find a horizontal word") public void testNotConcatenateDifferentLinesToFindAHorizontalWord() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("elixir", Optional.empty()); @@ -552,6 +575,7 @@ public void testNotConcatenateDifferentLinesToFindAHorizontalWord() { @Disabled("Remove to run test") @Test + @DisplayName("Should not wrap around horizontally to find a word") public void testNotWrapAroundHorizontallyToFindAWord() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("lisp", Optional.empty()); @@ -570,6 +594,7 @@ public void testNotWrapAroundHorizontallyToFindAWord() { @Disabled("Remove to run test") @Test + @DisplayName("Should not wrap around vertically to find a word") public void testNotWrapAroundVerticallyToFindAWord() { Map> expectedLocations = new HashMap<>(); expectedLocations.put("rust", Optional.empty()); diff --git a/exercises/practice/yacht/src/test/java/YachtTest.java b/exercises/practice/yacht/src/test/java/YachtTest.java index b2792817b..2a5e873e6 100644 --- a/exercises/practice/yacht/src/test/java/YachtTest.java +++ b/exercises/practice/yacht/src/test/java/YachtTest.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 YachtTest { @Test + @DisplayName("Yacht") public void yacht() { Yacht yacht = new Yacht(new int[]{ 5, 5, 5, 5, 5 }, YachtCategory.YACHT); assertThat(yacht.score()).isEqualTo(50); @@ -13,6 +15,7 @@ public void yacht() { @Disabled("Remove to run test") @Test + @DisplayName("Not Yacht") public void notYacht() { Yacht yacht = new Yacht(new int[]{ 1, 3, 3, 2, 5 }, YachtCategory.YACHT); assertThat(yacht.score()).isEqualTo(0); @@ -20,6 +23,7 @@ public void notYacht() { @Disabled("Remove to run test") @Test + @DisplayName("Ones") public void ones() { Yacht yacht = new Yacht(new int[]{ 1, 1, 1, 3, 5 }, YachtCategory.ONES); assertThat(yacht.score()).isEqualTo(3); @@ -27,6 +31,7 @@ public void ones() { @Disabled("Remove to run test") @Test + @DisplayName("Ones, out of order") public void onesOutOfOrder() { Yacht yacht = new Yacht(new int[]{ 3, 1, 1, 5, 1 }, YachtCategory.ONES); assertThat(yacht.score()).isEqualTo(3); @@ -34,6 +39,7 @@ public void onesOutOfOrder() { @Disabled("Remove to run test") @Test + @DisplayName("No ones") public void noOnes() { Yacht yacht = new Yacht(new int[]{ 4, 3, 6, 5, 5 }, YachtCategory.ONES); assertThat(yacht.score()).isEqualTo(0); @@ -41,6 +47,7 @@ public void noOnes() { @Disabled("Remove to run test") @Test + @DisplayName("Twos") public void twos() { Yacht yacht = new Yacht(new int[]{ 2, 3, 4, 5, 6 }, YachtCategory.TWOS); assertThat(yacht.score()).isEqualTo(2); @@ -48,6 +55,7 @@ public void twos() { @Disabled("Remove to run test") @Test + @DisplayName("Fours") public void fours() { Yacht yacht = new Yacht(new int[]{ 1, 4, 1, 4, 1 }, YachtCategory.FOURS); assertThat(yacht.score()).isEqualTo(8); @@ -55,6 +63,7 @@ public void fours() { @Disabled("Remove to run test") @Test + @DisplayName("Yacht counted as threes") public void yachtCountedAsThrees() { Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.THREES); assertThat(yacht.score()).isEqualTo(15); @@ -62,6 +71,7 @@ public void yachtCountedAsThrees() { @Disabled("Remove to run test") @Test + @DisplayName("Yacht of 3s counted as fives") public void yachtOfThreesCountedAsFives() { Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.FIVES); assertThat(yacht.score()).isEqualTo(0); @@ -69,6 +79,7 @@ public void yachtOfThreesCountedAsFives() { @Disabled("Remove to run test") @Test + @DisplayName("Fives") public void fives() { Yacht yacht = new Yacht(new int[]{ 1, 5, 3, 5, 3 }, YachtCategory.FIVES); assertThat(yacht.score()).isEqualTo(10); @@ -76,6 +87,7 @@ public void fives() { @Disabled("Remove to run test") @Test + @DisplayName("Sixes") public void sixes() { Yacht yacht = new Yacht(new int[]{ 2, 3, 4, 5, 6 }, YachtCategory.SIXES); assertThat(yacht.score()).isEqualTo(6); @@ -83,6 +95,7 @@ public void sixes() { @Disabled("Remove to run test") @Test + @DisplayName("Full house two small, three big") public void fullHouseTwoSmallThreeBig() { Yacht yacht = new Yacht(new int[]{ 2, 2, 4, 4, 4 }, YachtCategory.FULL_HOUSE); assertThat(yacht.score()).isEqualTo(16); @@ -90,6 +103,7 @@ public void fullHouseTwoSmallThreeBig() { @Disabled("Remove to run test") @Test + @DisplayName("Full house three small, two big") public void fullHouseThreeSmallTwoBig() { Yacht yacht = new Yacht(new int[]{ 5, 3, 3, 5, 3 }, YachtCategory.FULL_HOUSE); assertThat(yacht.score()).isEqualTo(19); @@ -97,6 +111,7 @@ public void fullHouseThreeSmallTwoBig() { @Disabled("Remove to run test") @Test + @DisplayName("Two pair is not a full house") public void twoPairIsNotAFullHouse() { Yacht yacht = new Yacht(new int[]{ 2, 2, 4, 4, 5 }, YachtCategory.FULL_HOUSE); assertThat(yacht.score()).isEqualTo(0); @@ -104,6 +119,7 @@ public void twoPairIsNotAFullHouse() { @Disabled("Remove to run test") @Test + @DisplayName("Four of a kind is not a full house") public void fourOfAKindIsNotAFullHouse() { Yacht yacht = new Yacht(new int[]{ 1, 4, 4, 4, 4 }, YachtCategory.FULL_HOUSE); assertThat(yacht.score()).isEqualTo(0); @@ -111,6 +127,7 @@ public void fourOfAKindIsNotAFullHouse() { @Disabled("Remove to run test") @Test + @DisplayName("Yacht is not a full house") public void yachtIsNotAFullHouse() { Yacht yacht = new Yacht(new int[]{ 2, 2, 2, 2, 2 }, YachtCategory.FULL_HOUSE); assertThat(yacht.score()).isEqualTo(0); @@ -118,6 +135,7 @@ public void yachtIsNotAFullHouse() { @Disabled("Remove to run test") @Test + @DisplayName("Four of a Kind") public void fourOfAKind() { Yacht yacht = new Yacht(new int[]{ 6, 6, 4, 6, 6 }, YachtCategory.FOUR_OF_A_KIND); assertThat(yacht.score()).isEqualTo(24); @@ -125,6 +143,7 @@ public void fourOfAKind() { @Disabled("Remove to run test") @Test + @DisplayName("Yacht can be scored as Four of a Kind") public void yachtCanBeScoredAsFourOfAKind() { Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.FOUR_OF_A_KIND); assertThat(yacht.score()).isEqualTo(12); @@ -132,6 +151,7 @@ public void yachtCanBeScoredAsFourOfAKind() { @Disabled("Remove to run test") @Test + @DisplayName("Full house is not Four of a Kind") public void fullHouseIsNotFourOfAKind() { Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 5, 5 }, YachtCategory.FOUR_OF_A_KIND); assertThat(yacht.score()).isEqualTo(0); @@ -139,6 +159,7 @@ public void fullHouseIsNotFourOfAKind() { @Disabled("Remove to run test") @Test + @DisplayName("Little Straight") public void littleStraight() { Yacht yacht = new Yacht(new int[]{ 3, 5, 4, 1, 2 }, YachtCategory.LITTLE_STRAIGHT); assertThat(yacht.score()).isEqualTo(30); @@ -146,6 +167,7 @@ public void littleStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Little Straight as Big Straight") public void littleStraightAsBigStraight() { Yacht yacht = new Yacht(new int[]{ 1, 2, 3, 4, 5 }, YachtCategory.BIG_STRAIGHT); assertThat(yacht.score()).isEqualTo(0); @@ -153,6 +175,7 @@ public void littleStraightAsBigStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Four in order but not a little straight") public void fourInOrderButNotALittleStraight() { Yacht yacht = new Yacht(new int[]{ 1, 1, 2, 3, 4 }, YachtCategory.LITTLE_STRAIGHT); assertThat(yacht.score()).isEqualTo(0); @@ -160,6 +183,7 @@ public void fourInOrderButNotALittleStraight() { @Disabled("Remove to run test") @Test + @DisplayName("No pairs but not a little straight") public void noPairsButNotALittleStraight() { Yacht yacht = new Yacht(new int[]{ 1, 2, 3, 4, 6 }, YachtCategory.LITTLE_STRAIGHT); assertThat(yacht.score()).isEqualTo(0); @@ -167,6 +191,7 @@ public void noPairsButNotALittleStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Minimum is 1, maximum is 5, but not a little straight") public void minimumIs1MaximumIs5ButNotALittleStraight() { Yacht yacht = new Yacht(new int[]{ 1, 1, 3, 4, 5 }, YachtCategory.LITTLE_STRAIGHT); assertThat(yacht.score()).isEqualTo(0); @@ -174,6 +199,7 @@ public void minimumIs1MaximumIs5ButNotALittleStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Big Straight") public void bigStraight() { Yacht yacht = new Yacht(new int[]{ 4, 6, 2, 5, 3 }, YachtCategory.BIG_STRAIGHT); assertThat(yacht.score()).isEqualTo(30); @@ -181,6 +207,7 @@ public void bigStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Big Straight as little straight") public void bigStraightAsLittleStraight() { Yacht yacht = new Yacht(new int[]{ 6, 5, 4, 3, 2 }, YachtCategory.LITTLE_STRAIGHT); assertThat(yacht.score()).isEqualTo(0); @@ -188,6 +215,7 @@ public void bigStraightAsLittleStraight() { @Disabled("Remove to run test") @Test + @DisplayName("No pairs but not a big straight") public void noPairsButNotABigStraight() { Yacht yacht = new Yacht(new int[]{ 6, 5, 4, 3, 1 }, YachtCategory.BIG_STRAIGHT); assertThat(yacht.score()).isEqualTo(0); @@ -195,6 +223,7 @@ public void noPairsButNotABigStraight() { @Disabled("Remove to run test") @Test + @DisplayName("Choice") public void choice() { Yacht yacht = new Yacht(new int[]{ 3, 3, 5, 6, 6 }, YachtCategory.CHOICE); assertThat(yacht.score()).isEqualTo(23); @@ -202,6 +231,7 @@ public void choice() { @Disabled("Remove to run test") @Test + @DisplayName("Yacht as choice") public void yachtAsChoice() { Yacht yacht = new Yacht(new int[]{ 2, 2, 2, 2, 2 }, YachtCategory.CHOICE); assertThat(yacht.score()).isEqualTo(10); diff --git a/exercises/practice/zebra-puzzle/src/test/java/ZebraPuzzleTest.java b/exercises/practice/zebra-puzzle/src/test/java/ZebraPuzzleTest.java index 911ebae5c..b0bb118fe 100644 --- a/exercises/practice/zebra-puzzle/src/test/java/ZebraPuzzleTest.java +++ b/exercises/practice/zebra-puzzle/src/test/java/ZebraPuzzleTest.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 ZebraPuzzleTest { @Test + @DisplayName("resident who drinks water") public void residentWhoDrinksWater() { ZebraPuzzle zebraPuzzle = new ZebraPuzzle(); assertThat(zebraPuzzle.getWaterDrinker()).isEqualTo("Norwegian"); @@ -13,6 +15,7 @@ public void residentWhoDrinksWater() { @Disabled("Remove to run test") @Test + @DisplayName("resident who owns zebra") public void residentWhoOwnsZebra() { ZebraPuzzle zebraPuzzle = new ZebraPuzzle(); assertThat(zebraPuzzle.getZebraOwner()).isEqualTo("Japanese");