diff --git a/exercises/practice/luhn/src/test/java/LuhnValidatorTest.java b/exercises/practice/luhn/src/test/java/LuhnValidatorTest.java index 12d3e5f3f..bc0c6d7dc 100644 --- a/exercises/practice/luhn/src/test/java/LuhnValidatorTest.java +++ b/exercises/practice/luhn/src/test/java/LuhnValidatorTest.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; @@ -13,132 +14,154 @@ public void setUp() { } @Test + @DisplayName("single digit strings can not be valid") public void testSingleDigitStringInvalid() { assertThat(luhnValidator.isValid("1")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("a single zero is invalid") public void testSingleZeroIsInvalid() { assertThat(luhnValidator.isValid("0")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("a simple valid SIN that remains valid if reversed") public void testSimpleValidSINReversedRemainsValid() { assertThat(luhnValidator.isValid("059")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("a simple valid SIN that becomes invalid if reversed") public void testSimpleValidSINReversedBecomesInvalid() { assertThat(luhnValidator.isValid("59")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("a valid Canadian SIN") public void testValidCanadianSINValid() { assertThat(luhnValidator.isValid("055 444 285")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("invalid Canadian SIN") public void testInvalidCanadianSINInvalid() { assertThat(luhnValidator.isValid("055 444 286")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("invalid credit card") public void testInvalidCreditCardInvalid() { assertThat(luhnValidator.isValid("8273 1232 7352 0569")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("invalid long number with an even remainder") public void testInvalidLongNumberWithAnEvenRemainder() { assertThat(luhnValidator.isValid("1 2345 6789 1234 5678 9012")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("invalid long number with a remainder divisible by 5") public void testInvalidLongNumberWithARemainderDivisibleBy5() { assertThat(luhnValidator.isValid("1 2345 6789 1234 5678 9013")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("valid number with an even number of digits") public void testValidNumberWithAnEvenNumberOfDigits() { assertThat(luhnValidator.isValid("095 245 88")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("valid number with an odd number of spaces") public void testValidNumberWithAnOddNumberOfSpaces() { assertThat(luhnValidator.isValid("234 567 891 234")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("valid strings with a non-digit added at the end become invalid") public void testValidStringsWithANonDigitAtEndInvalid() { assertThat(luhnValidator.isValid("059a")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("valid strings with punctuation included become invalid") public void testStringContainingPunctuationInvalid() { assertThat(luhnValidator.isValid("055-444-285")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("valid strings with symbols included become invalid") public void testStringContainingSymbolsInvalid() { assertThat(luhnValidator.isValid("055# 444$ 285")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("single zero with space is invalid") public void testSingleSpaceWithZeroInvalid() { assertThat(luhnValidator.isValid(" 0")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("more than a single zero is valid") public void testMoreThanSingleZeroValid() { assertThat(luhnValidator.isValid("0000 0")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("input digit 9 is correctly converted to output digit 9") public void testDigitNineConvertedToOutputNine() { assertThat(luhnValidator.isValid("091")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("very long input is valid") public void testVeryLongInputIsValid() { assertThat(luhnValidator.isValid("9999999999 9999999999 9999999999 9999999999")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("valid luhn with an odd number of digits and non zero first digit") public void testValidLuhnWithOddNumberOfDigitsAndNonZeroFirstDigit() { assertThat(luhnValidator.isValid("109")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("using ascii value for non-doubled non-digit isn't allowed") public void testUsingASCIIValueForNonDoubledNonDigitNotAllowed() { assertThat(luhnValidator.isValid("055b 444 285")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("using ascii value for doubled non-digit isn't allowed") public void testUsingASCIIValueForDoubledNonDigitNotAllowed() { assertThat(luhnValidator.isValid(":9")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("non-numeric, non-space char in the middle with a sum that's divisible by 10 isn't allowed") public void testNonNumericNonSpaceCharInMiddleWithSumDivisibleBy10IsNotAllowed() { assertThat(luhnValidator.isValid("59%59")).isFalse(); } @@ -150,7 +173,8 @@ public void testNonNumericNonSpaceCharInMiddleWithSumDivisibleBy10IsNotAllowed() */ @Disabled("Remove to run test") @Test - public void testStringContainingSymbolsInvalidJavaTrackSpecific() { + @DisplayName("string containing symbols is invalid (Java track specific)") + public void testStringContainingSymbolsIsInvalidJavaTrackSpecific() { assertThat(luhnValidator.isValid("85&")).isFalse(); } } diff --git a/exercises/practice/matrix/src/test/java/MatrixTest.java b/exercises/practice/matrix/src/test/java/MatrixTest.java index 3406ea8d7..5eb9ccfb4 100644 --- a/exercises/practice/matrix/src/test/java/MatrixTest.java +++ b/exercises/practice/matrix/src/test/java/MatrixTest.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 MatrixTest { @Test + @DisplayName("extract row from one number matrix") public void extractRowFromOneNumberMatrixTest() { String matrixAsString = "1"; int rowIndex = 1; @@ -18,6 +20,7 @@ public void extractRowFromOneNumberMatrixTest() { @Disabled("Remove to run test") @Test + @DisplayName("can extract row") public void extractRowFromMatrixTest() { String matrixAsString = "1 2\n3 4"; int rowIndex = 2; @@ -30,6 +33,7 @@ public void extractRowFromMatrixTest() { @Disabled("Remove to run test") @Test + @DisplayName("extract row where numbers have different widths") public void extractRowFromDiffWidthsMatrixTest() { String matrixAsString = "1 2\n10 20"; int rowIndex = 2; @@ -42,6 +46,7 @@ public void extractRowFromDiffWidthsMatrixTest() { @Disabled("Remove to run test") @Test + @DisplayName("can extract row from non-square matrix with no corresponding column") public void extractRowFromNonSquareMatrixTest() { String matrixAsString = "1 2 3\n4 5 6\n7 8 9\n8 7 6"; int rowIndex = 4; @@ -54,6 +59,7 @@ public void extractRowFromNonSquareMatrixTest() { @Disabled("Remove to run test") @Test + @DisplayName("extract column from one number matrix") public void extractColumnFromOneNumberMatrixTest() { String matrixAsString = "1"; int columnIndex = 1; @@ -66,6 +72,7 @@ public void extractColumnFromOneNumberMatrixTest() { @Disabled("Remove to run test") @Test + @DisplayName("can extract column") public void extractColumnMatrixTest() { String matrixAsString = "1 2 3\n4 5 6\n7 8 9"; int columnIndex = 3; @@ -78,6 +85,7 @@ public void extractColumnMatrixTest() { @Disabled("Remove to run test") @Test + @DisplayName("can extract column from non-square matrix with no corresponding row") public void extractColumnFromNonSquareMatrixTest() { String matrixAsString = "1 2 3 4\n5 6 7 8\n9 8 7 6"; int columnIndex = 4; @@ -90,6 +98,7 @@ public void extractColumnFromNonSquareMatrixTest() { @Disabled("Remove to run test") @Test + @DisplayName("extract column where numbers have different widths") public void extractColumnFromDiffWidthsMatrixTest() { String matrixAsString = "89 1903 3\n18 3 1\n9 4 800"; int columnIndex = 2; diff --git a/exercises/practice/pangram/src/test/java/PangramCheckerTest.java b/exercises/practice/pangram/src/test/java/PangramCheckerTest.java index 63a83513f..981e40172 100644 --- a/exercises/practice/pangram/src/test/java/PangramCheckerTest.java +++ b/exercises/practice/pangram/src/test/java/PangramCheckerTest.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,60 +15,70 @@ public void setup() { } @Test + @DisplayName("empty sentence") public void emptySentenceIsNotPangram() { assertThat(pangramChecker.isPangram("")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("perfect lower case") public void perfectLowerCasePhraseIsPangram() { assertThat(pangramChecker.isPangram("abcdefghijklmnopqrstuvwxyz")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("only lower case") public void phraseWithOnlyLowerCaseIsPangram() { assertThat(pangramChecker.isPangram("the quick brown fox jumps over the lazy dog")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("missing the letter 'x'") public void phraseMissingCharacterXIsNotPangram() { assertThat(pangramChecker.isPangram("a quick movement of the enemy will jeopardize five gunboats")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("missing the letter 'h'") public void phraseMissingCharacterHIsNotPangram() { assertThat(pangramChecker.isPangram("five boxing wizards jump quickly at it")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("with underscores") public void phraseWithUnderscoresIsPangram() { assertThat(pangramChecker.isPangram("the_quick_brown_fox_jumps_over_the_lazy_dog")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("with numbers") public void phraseWithNumbersIsPangram() { assertThat(pangramChecker.isPangram("the 1 quick brown fox jumps over the 2 lazy dogs")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("missing letters replaced by numbers") public void phraseWithMissingLettersReplacedByNumbersIsNotPangram() { assertThat(pangramChecker.isPangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog")).isFalse(); } @Disabled("Remove to run test") @Test + @DisplayName("mixed case and punctuation") public void phraseWithMixedCaseAndPunctuationIsPangram() { assertThat(pangramChecker.isPangram("\"Five quacking Zephyrs jolt my wax bed.\"")).isTrue(); } @Disabled("Remove to run test") @Test + @DisplayName("case insensitive") public void caseInsensitivePhraseIsNotPangram() { assertThat(pangramChecker.isPangram("abcdefghijklm ABCDEFGHIJKLM")).isFalse(); }