From 03ffb005fa41764232795845d4921d26630c82a5 Mon Sep 17 00:00:00 2001 From: Atharv Patil Date: Tue, 26 Aug 2025 09:41:23 +0530 Subject: [PATCH 1/4] affine-cipher,all-your-base,allergies --- .../src/test/java/AffineCipherTest.java | 18 ++++++- .../src/test/java/BaseConverterTest.java | 25 ++++++++- .../src/test/java/AllergiesTest.java | 51 +++++++++++++++++++ 3 files changed, 91 insertions(+), 3 deletions(-) diff --git a/exercises/practice/affine-cipher/src/test/java/AffineCipherTest.java b/exercises/practice/affine-cipher/src/test/java/AffineCipherTest.java index d37c96ade..83abfdf6e 100644 --- a/exercises/practice/affine-cipher/src/test/java/AffineCipherTest.java +++ b/exercises/practice/affine-cipher/src/test/java/AffineCipherTest.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,36 +9,41 @@ public class AffineCipherTest { private AffineCipher affineCipher = new AffineCipher(); + @DisplayName("encode yes") @Test public void testEncodeYes() { assertThat(affineCipher.encode("yes", 5, 7)).isEqualTo("xbt"); } + @DisplayName("encode no") @Disabled("Remove to run test") @Test public void testEncodeNo() { assertThat(affineCipher.encode("no", 15, 18)).isEqualTo("fu"); } - + @DisplayName("encode OMG") @Disabled("Remove to run test") @Test public void testEncodeOMG() { assertThat(affineCipher.encode("OMG", 21, 3)).isEqualTo("lvz"); } + @DisplayName("encode O M G") @Disabled("Remove to run test") @Test public void testEncodeO_M_G() { assertThat(affineCipher.encode("O M G", 25, 47)).isEqualTo("hjp"); } + @DisplayName("encode mindblowingly") @Disabled("Remove to run test") @Test public void testEncodeMindBlowingly() { assertThat(affineCipher.encode("mindblowingly", 11, 15)).isEqualTo("rzcwa gnxzc dgt"); } + @DisplayName("encode numbers") @Disabled("Remove to run test") @Test public void testEncodeNumbers() { @@ -45,6 +51,7 @@ public void testEncodeNumbers() { .isEqualTo("jqgjc rw123 jqgjc rw"); } + @DisplayName("encode deep thought") @Disabled("Remove to run test") @Test public void testEncodeDeepThought() { @@ -52,6 +59,7 @@ public void testEncodeDeepThought() { .isEqualTo("iynia fdqfb ifje"); } + @DisplayName("encode all the letters") @Disabled("Remove to run test") @Test public void testEncodeAllTheLetters() { @@ -59,6 +67,7 @@ public void testEncodeAllTheLetters() { .isEqualTo("swxtj npvyk lruol iejdc blaxk swxmh qzglf"); } + @DisplayName("encode with a not coprime to m") @Disabled("Remove to run test") @Test public void testEncodeThrowsMeaningfulException() { @@ -67,6 +76,7 @@ public void testEncodeThrowsMeaningfulException() { .withMessage("Error: keyA and alphabet size must be coprime."); } + @DisplayName("decode exercism") @Disabled("Remove to run test") @Test public void testDecodeExercism() { @@ -74,6 +84,7 @@ public void testDecodeExercism() { .isEqualTo("exercism"); } + @DisplayName("decode a sentence") @Disabled("Remove to run test") @Test public void testDecodeSentence() { @@ -81,6 +92,7 @@ public void testDecodeSentence() { .isEqualTo("anobstacleisoftenasteppingstone"); } + @DisplayName("decode numbers") @Disabled("Remove to run test") @Test public void testDecodeNumbers() { @@ -88,6 +100,7 @@ public void testDecodeNumbers() { .isEqualTo("testing123testing"); } + @DisplayName("decode all the letters") @Disabled("Remove to run test") @Test public void testDecodeAllTheLetters() { @@ -95,6 +108,7 @@ public void testDecodeAllTheLetters() { .isEqualTo("thequickbrownfoxjumpsoverthelazydog"); } + @DisplayName("decode with no spaces in input") @Disabled("Remove to run test") @Test public void testDecodeWithNoSpaces() { @@ -102,6 +116,7 @@ public void testDecodeWithNoSpaces() { .isEqualTo("thequickbrownfoxjumpsoverthelazydog"); } + @DisplayName("decode with too many spaces") @Disabled("Remove to run test") @Test public void testDecodeWithTooManySpaces() { @@ -109,6 +124,7 @@ public void testDecodeWithTooManySpaces() { .isEqualTo("jollygreengiant"); } + @DisplayName("decode with a not coprime to m") @Disabled("Remove to run test") @Test public void testDecodeThrowsMeaningfulException() { diff --git a/exercises/practice/all-your-base/src/test/java/BaseConverterTest.java b/exercises/practice/all-your-base/src/test/java/BaseConverterTest.java index c84e97af0..1a11d1201 100644 --- a/exercises/practice/all-your-base/src/test/java/BaseConverterTest.java +++ b/exercises/practice/all-your-base/src/test/java/BaseConverterTest.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 BaseConverterTest { + @DisplayName("single bit one to decimal") @Test public void testSingleBitOneToDecimal() { BaseConverter baseConverter = new BaseConverter(2, new int[]{1}); @@ -14,6 +16,7 @@ public void testSingleBitOneToDecimal() { .containsExactly(1); } + @DisplayName("binary to single decimal") @Disabled("Remove to run test") @Test public void testBinaryToSingleDecimal() { @@ -23,6 +26,7 @@ public void testBinaryToSingleDecimal() { .containsExactly(5); } + @DisplayName("single decimal to binary") @Disabled("Remove to run test") @Test public void testSingleDecimalToBinary() { @@ -32,6 +36,7 @@ public void testSingleDecimalToBinary() { .containsExactly(1, 0, 1); } + @DisplayName("binary to multiple decimal") @Disabled("Remove to run test") @Test public void testBinaryToMultipleDecimal() { @@ -41,6 +46,7 @@ public void testBinaryToMultipleDecimal() { .containsExactly(4, 2); } + @DisplayName("decimal to binary") @Disabled("Remove to run test") @Test public void testDecimalToBinary() { @@ -50,6 +56,7 @@ public void testDecimalToBinary() { .containsExactly(1, 0, 1, 0, 1, 0); } + @DisplayName("trinary to hexadecimal") @Disabled("Remove to run test") @Test public void testTrinaryToHexadecimal() { @@ -59,6 +66,7 @@ public void testTrinaryToHexadecimal() { .containsExactly(2, 10); } + @DisplayName("hexadecimal to trinary") @Disabled("Remove to run test") @Test public void testHexadecimalToTrinary() { @@ -68,6 +76,7 @@ public void testHexadecimalToTrinary() { .containsExactly(1, 1, 2, 0); } + @DisplayName("15-bit integer") @Disabled("Remove to run test") @Test public void test15BitInteger() { @@ -77,6 +86,7 @@ public void test15BitInteger() { .containsExactly(6, 10, 45); } + @DisplayName("empty list") @Disabled("Remove to run test") @Test public void testEmptyDigits() { @@ -86,6 +96,7 @@ public void testEmptyDigits() { .containsExactly(0); } + @DisplayName("single zero") @Disabled("Remove to run test") @Test public void testSingleZero() { @@ -95,6 +106,7 @@ public void testSingleZero() { .containsExactly(0); } + @DisplayName("multiple zeros") @Disabled("Remove to run test") @Test public void testMultipleZeros() { @@ -104,6 +116,7 @@ public void testMultipleZeros() { .containsExactly(0); } + @DisplayName("leading zeros") @Disabled("Remove to run test") @Test public void testLeadingZeros() { @@ -113,22 +126,25 @@ public void testLeadingZeros() { .containsExactly(4, 2); } + @DisplayName("input base is one") @Disabled("Remove to run test") @Test public void testFirstBaseIsOne() { assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> new BaseConverter(1, new int[]{1})) + .isThrownBy(() -> new BaseConverter(1, new int[]{0})) .withMessage("Bases must be at least 2."); } + @DisplayName("input base is zero") @Disabled("Remove to run test") @Test public void testFirstBaseIsZero() { assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> new BaseConverter(0, new int[]{1})) + .isThrownBy(() -> new BaseConverter(0, new int[]{})) .withMessage("Bases must be at least 2."); } + @DisplayName("input base is negative") @Disabled("Remove to run test") @Test public void testFirstBaseIsNegative() { @@ -137,6 +153,7 @@ public void testFirstBaseIsNegative() { .withMessage("Bases must be at least 2."); } + @DisplayName("negative digit") @Disabled("Remove to run test") @Test public void testNegativeDigit() { @@ -145,6 +162,7 @@ public void testNegativeDigit() { .withMessage("Digits may not be negative."); } + @DisplayName("invalid positive digit") @Disabled("Remove to run test") @Test public void testInvalidPositiveDigit() { @@ -153,6 +171,7 @@ public void testInvalidPositiveDigit() { .withMessage("All digits must be strictly less than the base."); } + @DisplayName("output base is one") @Disabled("Remove to run test") @Test public void testSecondBaseIsOne() { @@ -164,6 +183,7 @@ public void testSecondBaseIsOne() { .withMessage("Bases must be at least 2."); } + @DisplayName("output base is zero") @Disabled("Remove to run test") @Test public void testSecondBaseIsZero() { @@ -174,6 +194,7 @@ public void testSecondBaseIsZero() { .withMessage("Bases must be at least 2."); } + @DisplayName("output base is negative") @Disabled("Remove to run test") @Test public void testSecondBaseIsNegative() { diff --git a/exercises/practice/allergies/src/test/java/AllergiesTest.java b/exercises/practice/allergies/src/test/java/AllergiesTest.java index 851b40656..3d0826647 100644 --- a/exercises/practice/allergies/src/test/java/AllergiesTest.java +++ b/exercises/practice/allergies/src/test/java/AllergiesTest.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 AllergiesTest { // Testing for eggs allergy + @DisplayName("not allergic to anything") @Test public void eggsNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -15,6 +17,7 @@ public void eggsNotAllergicToAnything() { assertThat(allergies.isAllergicTo(Allergen.EGGS)).isFalse(); } + @DisplayName("allergic only to eggs") @Disabled("Remove to run test") @Test public void eggsAllergicOnlyToEggs() { @@ -23,6 +26,7 @@ public void eggsAllergicOnlyToEggs() { assertThat(allergies.isAllergicTo(Allergen.EGGS)).isTrue(); } + @DisplayName("allergic to eggs and something else") @Disabled("Remove to run test") @Test public void eggsAllergicToEggsAndSomethingElse() { @@ -31,6 +35,7 @@ public void eggsAllergicToEggsAndSomethingElse() { assertThat(allergies.isAllergicTo(Allergen.EGGS)).isTrue(); } + @DisplayName("allergic to something, but not eggs") @Disabled("Remove to run test") @Test public void eggsAllergicToSomethingButNotEggs() { @@ -39,6 +44,7 @@ public void eggsAllergicToSomethingButNotEggs() { assertThat(allergies.isAllergicTo(Allergen.EGGS)).isFalse(); } + @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test public void eggsAllergicToEverything() { @@ -50,6 +56,7 @@ public void eggsAllergicToEverything() { // Testing for peanuts allergy + @DisplayName("not allergic to anything") @Test public void peanutsNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -57,6 +64,7 @@ public void peanutsNotAllergicToAnything() { assertThat(allergies.isAllergicTo(Allergen.PEANUTS)).isFalse(); } + @DisplayName("allergic only to peanuts") @Disabled("Remove to run test") @Test public void peanutsAllergicOnlyToPeanuts() { @@ -65,6 +73,7 @@ public void peanutsAllergicOnlyToPeanuts() { assertThat(allergies.isAllergicTo(Allergen.PEANUTS)).isTrue(); } + @DisplayName("allergic to peanuts and something else") @Disabled("Remove to run test") @Test public void peanutsAllergicToPeanutsAndSomethingElse() { @@ -73,6 +82,7 @@ public void peanutsAllergicToPeanutsAndSomethingElse() { assertThat(allergies.isAllergicTo(Allergen.PEANUTS)).isTrue(); } + @DisplayName("allergic to something, but not peanuts") @Disabled("Remove to run test") @Test public void peanutsAllergicToSomethingButNotPeanuts() { @@ -81,6 +91,7 @@ public void peanutsAllergicToSomethingButNotPeanuts() { assertThat(allergies.isAllergicTo(Allergen.PEANUTS)).isFalse(); } + @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test public void peanutsAllergicToEverything() { @@ -92,6 +103,7 @@ public void peanutsAllergicToEverything() { // Testing for shellfish allergy + @DisplayName("not allergic to anything") @Test public void shellfishNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -99,6 +111,7 @@ public void shellfishNotAllergicToAnything() { assertThat(allergies.isAllergicTo(Allergen.SHELLFISH)).isFalse(); } + @DisplayName("allergic only to shellfish") @Disabled("Remove to run test") @Test public void shellfishAllergicOnlyToShellfish() { @@ -107,6 +120,7 @@ public void shellfishAllergicOnlyToShellfish() { assertThat(allergies.isAllergicTo(Allergen.SHELLFISH)).isTrue(); } + @DisplayName("allergic to shellfish and something else") @Disabled("Remove to run test") @Test public void shellfishAllergicToShellfishAndSomethingElse() { @@ -115,6 +129,7 @@ public void shellfishAllergicToShellfishAndSomethingElse() { assertThat(allergies.isAllergicTo(Allergen.SHELLFISH)).isTrue(); } + @DisplayName("allergic to something, but not shellfish") @Disabled("Remove to run test") @Test public void shellfishAllergicToSomethingButNotShellfish() { @@ -123,6 +138,7 @@ public void shellfishAllergicToSomethingButNotShellfish() { assertThat(allergies.isAllergicTo(Allergen.SHELLFISH)).isFalse(); } + @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test public void shellfishAllergicToEverything() { @@ -134,6 +150,7 @@ public void shellfishAllergicToEverything() { // Testing for strawberries allergy + @DisplayName("not allergic to anything") @Test public void strawberriesNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -141,6 +158,7 @@ public void strawberriesNotAllergicToAnything() { assertThat(allergies.isAllergicTo(Allergen.STRAWBERRIES)).isFalse(); } + @DisplayName("allergic only to strawberries") @Disabled("Remove to run test") @Test public void strawberriesAllergicOnlyToStrawberries() { @@ -149,6 +167,7 @@ public void strawberriesAllergicOnlyToStrawberries() { assertThat(allergies.isAllergicTo(Allergen.STRAWBERRIES)).isTrue(); } + @DisplayName("allergic to strawberries and something else") @Disabled("Remove to run test") @Test public void strawberriesAllergicToStrawberriesAndSomethingElse() { @@ -157,6 +176,7 @@ public void strawberriesAllergicToStrawberriesAndSomethingElse() { assertThat(allergies.isAllergicTo(Allergen.STRAWBERRIES)).isTrue(); } + @DisplayName("allergic to something, but not strawberries") @Disabled("Remove to run test") @Test public void strawberriesAllergicToSomethingButNotStrawberries() { @@ -165,6 +185,7 @@ public void strawberriesAllergicToSomethingButNotStrawberries() { assertThat(allergies.isAllergicTo(Allergen.STRAWBERRIES)).isFalse(); } + @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test public void strawberriesAllergicToEverything() { @@ -176,6 +197,7 @@ public void strawberriesAllergicToEverything() { // Testing for tomatoes allergy + @DisplayName("not allergic to anything") @Test public void tomatoesNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -183,6 +205,7 @@ public void tomatoesNotAllergicToAnything() { assertThat(allergies.isAllergicTo(Allergen.TOMATOES)).isFalse(); } + @DisplayName("allergic only to tomatoes") @Disabled("Remove to run test") @Test public void tomatoesAllergicOnlyToTomatoes() { @@ -191,6 +214,7 @@ public void tomatoesAllergicOnlyToTomatoes() { assertThat(allergies.isAllergicTo(Allergen.TOMATOES)).isTrue(); } + @DisplayName("allergic to tomatoes and something else") @Disabled("Remove to run test") @Test public void tomatoesAllergicToTomatoesAndSomethingElse() { @@ -199,6 +223,7 @@ public void tomatoesAllergicToTomatoesAndSomethingElse() { assertThat(allergies.isAllergicTo(Allergen.TOMATOES)).isTrue(); } + @DisplayName("allergic to something, but not tomatoes") @Disabled("Remove to run test") @Test public void tomatoesAllergicToSomethingButNotTomatoes() { @@ -207,6 +232,7 @@ public void tomatoesAllergicToSomethingButNotTomatoes() { assertThat(allergies.isAllergicTo(Allergen.TOMATOES)).isFalse(); } + @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test public void tomatoesAllergicToEverything() { @@ -218,6 +244,7 @@ public void tomatoesAllergicToEverything() { // Testing for chocolate allergy + @DisplayName("not allergic to anything") @Test public void chocolateNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -225,6 +252,7 @@ public void chocolateNotAllergicToAnything() { assertThat(allergies.isAllergicTo(Allergen.CHOCOLATE)).isFalse(); } + @DisplayName("allergic only to chocolate") @Disabled("Remove to run test") @Test public void chocolateAllergicOnlyToChocolate() { @@ -233,6 +261,7 @@ public void chocolateAllergicOnlyToChocolate() { assertThat(allergies.isAllergicTo(Allergen.CHOCOLATE)).isTrue(); } + @DisplayName("allergic to chocolate and something else") @Disabled("Remove to run test") @Test public void chocolateAllergicToChocolateAndSomethingElse() { @@ -241,6 +270,7 @@ public void chocolateAllergicToChocolateAndSomethingElse() { assertThat(allergies.isAllergicTo(Allergen.CHOCOLATE)).isTrue(); } + @DisplayName("allergic to something, but not chocolate") @Disabled("Remove to run test") @Test public void chocolateAllergicToSomethingButNotChocolate() { @@ -249,6 +279,7 @@ public void chocolateAllergicToSomethingButNotChocolate() { assertThat(allergies.isAllergicTo(Allergen.CHOCOLATE)).isFalse(); } + @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test public void chocolateAllergicToEverything() { @@ -260,6 +291,7 @@ public void chocolateAllergicToEverything() { // Testing for pollen allergy + @DisplayName("not allergic to anything") @Test public void pollenNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -267,6 +299,7 @@ public void pollenNotAllergicToAnything() { assertThat(allergies.isAllergicTo(Allergen.POLLEN)).isFalse(); } + @DisplayName("allergic only to pollen") @Disabled("Remove to run test") @Test public void pollenAllergicOnlyToPollen() { @@ -275,6 +308,7 @@ public void pollenAllergicOnlyToPollen() { assertThat(allergies.isAllergicTo(Allergen.POLLEN)).isTrue(); } + @DisplayName("allergic to pollen and something else") @Disabled("Remove to run test") @Test public void pollenAllergicToPollenAndSomethingElse() { @@ -283,6 +317,7 @@ public void pollenAllergicToPollenAndSomethingElse() { assertThat(allergies.isAllergicTo(Allergen.POLLEN)).isTrue(); } + @DisplayName("allergic to something, but not pollen") @Disabled("Remove to run test") @Test public void pollenAllergicToSomethingButNotPollen() { @@ -291,6 +326,7 @@ public void pollenAllergicToSomethingButNotPollen() { assertThat(allergies.isAllergicTo(Allergen.POLLEN)).isFalse(); } + @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test public void pollenAllergicToEverything() { @@ -302,6 +338,7 @@ public void pollenAllergicToEverything() { // Testing for cats allergy + @DisplayName("not allergic to anything") @Test public void catsNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -309,6 +346,7 @@ public void catsNotAllergicToAnything() { assertThat(allergies.isAllergicTo(Allergen.CATS)).isFalse(); } + @DisplayName("allergic only to cats") @Disabled("Remove to run test") @Test public void catsAllergicOnlyToCats() { @@ -317,6 +355,7 @@ public void catsAllergicOnlyToCats() { assertThat(allergies.isAllergicTo(Allergen.CATS)).isTrue(); } + @DisplayName("allergic to cats and something else") @Disabled("Remove to run test") @Test public void catsAllergicToCatsAndSomethingElse() { @@ -325,6 +364,7 @@ public void catsAllergicToCatsAndSomethingElse() { assertThat(allergies.isAllergicTo(Allergen.CATS)).isTrue(); } + @DisplayName("allergic to something, but not cats") @Disabled("Remove to run test") @Test public void catsAllergicToSomethingButNotCats() { @@ -333,6 +373,7 @@ public void catsAllergicToSomethingButNotCats() { assertThat(allergies.isAllergicTo(Allergen.CATS)).isFalse(); } + @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test public void catsAllergicToEverything() { @@ -344,6 +385,7 @@ public void catsAllergicToEverything() { // Testing listing allergies + @DisplayName("no allergies") @Disabled("Remove to run test") @Test public void listNoAllergies() { @@ -352,6 +394,7 @@ public void listNoAllergies() { assertThat(allergies.getList().size()).isEqualTo(0); } + @DisplayName("just eggs") @Disabled("Remove to run test") @Test public void listJustEggs() { @@ -361,6 +404,7 @@ public void listJustEggs() { .containsExactly(Allergen.EGGS); } + @DisplayName("just peanuts") @Disabled("Remove to run test") @Test public void listJustPeanuts() { @@ -370,6 +414,7 @@ public void listJustPeanuts() { .containsExactly(Allergen.PEANUTS); } + @DisplayName("just strawberries") @Disabled("Remove to run test") @Test public void listJustStrawberries() { @@ -379,6 +424,7 @@ public void listJustStrawberries() { .containsExactly(Allergen.STRAWBERRIES); } + @DisplayName("eggs and peanuts") @Disabled("Remove to run test") @Test public void listEggsAndPeanuts() { @@ -390,6 +436,7 @@ public void listEggsAndPeanuts() { Allergen.PEANUTS); } + @DisplayName("more than eggs but not peanuts") @Disabled("Remove to run test") @Test public void listoMoreThanEggsButNotPeanuts() { @@ -401,6 +448,7 @@ public void listoMoreThanEggsButNotPeanuts() { Allergen.SHELLFISH); } + @DisplayName("lots of stuff") @Disabled("Remove to run test") @Test public void listManyAllergies() { @@ -415,6 +463,7 @@ public void listManyAllergies() { Allergen.CATS); } + @DisplayName("everything") @Disabled("Remove to run test") @Test public void listEverything() { @@ -432,6 +481,7 @@ public void listEverything() { Allergen.CATS); } + @DisplayName("no allergen score parts") @Disabled("Remove to run test") @Test public void listNoAllergenScoreParts() { @@ -448,6 +498,7 @@ public void listNoAllergenScoreParts() { Allergen.CATS); } + @DisplayName("no allergen score parts without highest valid score") @Disabled("Remove to run test") @Test public void listNoAllergenScorePartsWithoutHighestValidScore() { From 5c65ced5e731cfd1b8fe5831a75969582ded6e4c Mon Sep 17 00:00:00 2001 From: Atharv Patil Date: Tue, 26 Aug 2025 13:44:57 +0530 Subject: [PATCH 2/4] acronym, affine-cipher, all-your-base, allergies --- .../acronym/src/test/java/AcronymTest.java | 18 ++-- .../src/test/java/AffineCipherTest.java | 32 +++--- .../src/test/java/BaseConverterTest.java | 40 +++---- .../src/test/java/AllergiesTest.java | 100 +++++++++--------- 4 files changed, 95 insertions(+), 95 deletions(-) diff --git a/exercises/practice/acronym/src/test/java/AcronymTest.java b/exercises/practice/acronym/src/test/java/AcronymTest.java index 967c3f05a..e4b572d2f 100644 --- a/exercises/practice/acronym/src/test/java/AcronymTest.java +++ b/exercises/practice/acronym/src/test/java/AcronymTest.java @@ -7,72 +7,72 @@ public class AcronymTest { - @DisplayName("basic") @Test + @DisplayName("basic") public void basic() { assertThat(new Acronym("Portable Network Graphics").get()) .isEqualTo("PNG"); } - @DisplayName("lowercase words") @Disabled("Remove to run test") @Test + @DisplayName("lowercase words") public void lowercaseWords() { assertThat(new Acronym("Ruby on Rails").get()) .isEqualTo("ROR"); } - @DisplayName("punctuation") @Disabled("Remove to run test") @Test + @DisplayName("punctuation") public void punctuation() { assertThat(new Acronym("First In, First Out").get()) .isEqualTo("FIFO"); } - @DisplayName("all caps word") @Disabled("Remove to run test") @Test + @DisplayName("all caps word") public void nonAcronymAllCapsWord() { assertThat(new Acronym("GNU Image Manipulation Program").get()) .isEqualTo("GIMP"); } - @DisplayName("punctuation without whitespace") @Disabled("Remove to run test") @Test + @DisplayName("punctuation without whitespace") public void punctuationWithoutWhitespace() { assertThat(new Acronym("Complementary metal-oxide semiconductor").get()) .isEqualTo("CMOS"); } - @DisplayName("very long abbreviation") @Disabled("Remove to run test") @Test + @DisplayName("very long abbreviation") public void veryLongAbbreviation() { assertThat(new Acronym("Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me").get()) .isEqualTo("ROTFLSHTMDCOALM"); } - @DisplayName("consecutive delimiters") @Disabled("Remove to run test") @Test + @DisplayName("consecutive delimiters") public void consecutiveDelimiters() { assertThat(new Acronym("Something - I made up from thin air").get()) .isEqualTo("SIMUFTA"); } - @DisplayName("apostrophes") @Disabled("Remove to run test") @Test + @DisplayName("apostrophes") public void apostrophes() { assertThat(new Acronym("Halley's Comet").get()) .isEqualTo("HC"); } - @DisplayName("underscore emphasis") @Disabled("Remove to run test") @Test + @DisplayName("underscore emphasis") public void underscoreEmphasis() { assertThat(new Acronym("The Road _Not_ Taken").get()) .isEqualTo("TRNT"); diff --git a/exercises/practice/affine-cipher/src/test/java/AffineCipherTest.java b/exercises/practice/affine-cipher/src/test/java/AffineCipherTest.java index 83abfdf6e..668631a5c 100644 --- a/exercises/practice/affine-cipher/src/test/java/AffineCipherTest.java +++ b/exercises/practice/affine-cipher/src/test/java/AffineCipherTest.java @@ -9,124 +9,124 @@ public class AffineCipherTest { private AffineCipher affineCipher = new AffineCipher(); - @DisplayName("encode yes") @Test + @DisplayName("encode yes") public void testEncodeYes() { assertThat(affineCipher.encode("yes", 5, 7)).isEqualTo("xbt"); } - @DisplayName("encode no") @Disabled("Remove to run test") @Test + @DisplayName("encode no") public void testEncodeNo() { assertThat(affineCipher.encode("no", 15, 18)).isEqualTo("fu"); } - @DisplayName("encode OMG") @Disabled("Remove to run test") + @DisplayName("encode OMG") @Test public void testEncodeOMG() { assertThat(affineCipher.encode("OMG", 21, 3)).isEqualTo("lvz"); } - @DisplayName("encode O M G") @Disabled("Remove to run test") @Test + @DisplayName("encode O M G") public void testEncodeO_M_G() { assertThat(affineCipher.encode("O M G", 25, 47)).isEqualTo("hjp"); } - @DisplayName("encode mindblowingly") @Disabled("Remove to run test") @Test + @DisplayName("encode mindblowingly") public void testEncodeMindBlowingly() { assertThat(affineCipher.encode("mindblowingly", 11, 15)).isEqualTo("rzcwa gnxzc dgt"); } - @DisplayName("encode numbers") @Disabled("Remove to run test") @Test + @DisplayName("encode numbers") public void testEncodeNumbers() { assertThat(affineCipher.encode("Testing,1 2 3, testing.", 3, 4)) .isEqualTo("jqgjc rw123 jqgjc rw"); } - @DisplayName("encode deep thought") @Disabled("Remove to run test") @Test + @DisplayName("encode deep thought") public void testEncodeDeepThought() { assertThat(affineCipher.encode("Truth is fiction.", 5, 17)) .isEqualTo("iynia fdqfb ifje"); } - @DisplayName("encode all the letters") @Disabled("Remove to run test") @Test + @DisplayName("encode all the letters") public void testEncodeAllTheLetters() { assertThat(affineCipher.encode("The quick brown fox jumps over the lazy dog.", 17, 33)) .isEqualTo("swxtj npvyk lruol iejdc blaxk swxmh qzglf"); } - @DisplayName("encode with a not coprime to m") @Disabled("Remove to run test") @Test + @DisplayName("encode with a not coprime to m") public void testEncodeThrowsMeaningfulException() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> affineCipher.encode("This is a test", 6, 17)) .withMessage("Error: keyA and alphabet size must be coprime."); } - @DisplayName("decode exercism") @Disabled("Remove to run test") @Test + @DisplayName("decode exercism") public void testDecodeExercism() { assertThat(affineCipher.decode("tytgn fjr", 3, 7)) .isEqualTo("exercism"); } - @DisplayName("decode a sentence") @Disabled("Remove to run test") @Test + @DisplayName("decode a sentence") public void testDecodeSentence() { assertThat(affineCipher.decode("qdwju nqcro muwhn odqun oppmd aunwd o", 19, 16)) .isEqualTo("anobstacleisoftenasteppingstone"); } - @DisplayName("decode numbers") @Disabled("Remove to run test") @Test + @DisplayName("decode numbers") public void testDecodeNumbers() { assertThat(affineCipher.decode("odpoz ub123 odpoz ub", 25, 7)) .isEqualTo("testing123testing"); } - @DisplayName("decode all the letters") @Disabled("Remove to run test") @Test + @DisplayName("decode all the letters") public void testDecodeAllTheLetters() { assertThat(affineCipher.decode("swxtj npvyk lruol iejdc blaxk swxmh qzglf", 17, 33)) .isEqualTo("thequickbrownfoxjumpsoverthelazydog"); } - @DisplayName("decode with no spaces in input") @Disabled("Remove to run test") @Test + @DisplayName("decode with no spaces in input") public void testDecodeWithNoSpaces() { assertThat(affineCipher.decode("swxtjnpvyklruoliejdcblaxkswxmhqzglf", 17, 33)) .isEqualTo("thequickbrownfoxjumpsoverthelazydog"); } - @DisplayName("decode with too many spaces") @Disabled("Remove to run test") @Test + @DisplayName("decode with too many spaces") public void testDecodeWithTooManySpaces() { assertThat(affineCipher.decode("vszzm cly yd cg qdp", 15, 16)) .isEqualTo("jollygreengiant"); } - @DisplayName("decode with a not coprime to m") @Disabled("Remove to run test") @Test + @DisplayName("decode with a not coprime to m") public void testDecodeThrowsMeaningfulException() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> affineCipher.decode("Test", 13, 5)) diff --git a/exercises/practice/all-your-base/src/test/java/BaseConverterTest.java b/exercises/practice/all-your-base/src/test/java/BaseConverterTest.java index 1a11d1201..c2ca95a70 100644 --- a/exercises/practice/all-your-base/src/test/java/BaseConverterTest.java +++ b/exercises/practice/all-your-base/src/test/java/BaseConverterTest.java @@ -7,8 +7,8 @@ public class BaseConverterTest { - @DisplayName("single bit one to decimal") @Test + @DisplayName("single bit one to decimal") public void testSingleBitOneToDecimal() { BaseConverter baseConverter = new BaseConverter(2, new int[]{1}); @@ -16,9 +16,9 @@ public void testSingleBitOneToDecimal() { .containsExactly(1); } - @DisplayName("binary to single decimal") @Disabled("Remove to run test") @Test + @DisplayName("binary to single decimal") public void testBinaryToSingleDecimal() { BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1}); @@ -26,9 +26,9 @@ public void testBinaryToSingleDecimal() { .containsExactly(5); } - @DisplayName("single decimal to binary") @Disabled("Remove to run test") @Test + @DisplayName("single decimal to binary") public void testSingleDecimalToBinary() { BaseConverter baseConverter = new BaseConverter(10, new int[]{5}); @@ -36,9 +36,9 @@ public void testSingleDecimalToBinary() { .containsExactly(1, 0, 1); } - @DisplayName("binary to multiple decimal") @Disabled("Remove to run test") @Test + @DisplayName("binary to multiple decimal") public void testBinaryToMultipleDecimal() { BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0}); @@ -46,9 +46,9 @@ public void testBinaryToMultipleDecimal() { .containsExactly(4, 2); } - @DisplayName("decimal to binary") @Disabled("Remove to run test") @Test + @DisplayName("decimal to binary") public void testDecimalToBinary() { BaseConverter baseConverter = new BaseConverter(10, new int[]{4, 2}); @@ -56,9 +56,9 @@ public void testDecimalToBinary() { .containsExactly(1, 0, 1, 0, 1, 0); } - @DisplayName("trinary to hexadecimal") @Disabled("Remove to run test") @Test + @DisplayName("trinary to hexadecimal") public void testTrinaryToHexadecimal() { BaseConverter baseConverter = new BaseConverter(3, new int[]{1, 1, 2, 0}); @@ -66,9 +66,9 @@ public void testTrinaryToHexadecimal() { .containsExactly(2, 10); } - @DisplayName("hexadecimal to trinary") @Disabled("Remove to run test") @Test + @DisplayName("hexadecimal to trinary") public void testHexadecimalToTrinary() { BaseConverter baseConverter = new BaseConverter(16, new int[]{2, 10}); @@ -76,9 +76,9 @@ public void testHexadecimalToTrinary() { .containsExactly(1, 1, 2, 0); } - @DisplayName("15-bit integer") @Disabled("Remove to run test") @Test + @DisplayName("15-bit integer") public void test15BitInteger() { BaseConverter baseConverter = new BaseConverter(97, new int[]{3, 46, 60}); @@ -86,9 +86,9 @@ public void test15BitInteger() { .containsExactly(6, 10, 45); } - @DisplayName("empty list") @Disabled("Remove to run test") @Test + @DisplayName("empty list") public void testEmptyDigits() { BaseConverter baseConverter = new BaseConverter(2, new int[]{}); @@ -96,9 +96,9 @@ public void testEmptyDigits() { .containsExactly(0); } - @DisplayName("single zero") @Disabled("Remove to run test") @Test + @DisplayName("single zero") public void testSingleZero() { BaseConverter baseConverter = new BaseConverter(10, new int[]{0}); @@ -106,9 +106,9 @@ public void testSingleZero() { .containsExactly(0); } - @DisplayName("multiple zeros") @Disabled("Remove to run test") @Test + @DisplayName("multiple zeros") public void testMultipleZeros() { BaseConverter baseConverter = new BaseConverter(10, new int[]{0, 0, 0}); @@ -116,9 +116,9 @@ public void testMultipleZeros() { .containsExactly(0); } - @DisplayName("leading zeros") @Disabled("Remove to run test") @Test + @DisplayName("leading zeros") public void testLeadingZeros() { BaseConverter baseConverter = new BaseConverter(7, new int[]{0, 6, 0}); @@ -126,54 +126,54 @@ public void testLeadingZeros() { .containsExactly(4, 2); } - @DisplayName("input base is one") @Disabled("Remove to run test") @Test + @DisplayName("input base is one") public void testFirstBaseIsOne() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new BaseConverter(1, new int[]{0})) .withMessage("Bases must be at least 2."); } - @DisplayName("input base is zero") @Disabled("Remove to run test") @Test + @DisplayName("input base is zero") public void testFirstBaseIsZero() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new BaseConverter(0, new int[]{})) .withMessage("Bases must be at least 2."); } - @DisplayName("input base is negative") @Disabled("Remove to run test") @Test + @DisplayName("input base is negative") public void testFirstBaseIsNegative() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new BaseConverter(-2, new int[]{1})) .withMessage("Bases must be at least 2."); } - @DisplayName("negative digit") @Disabled("Remove to run test") @Test + @DisplayName("negative digit") public void testNegativeDigit() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new BaseConverter(2, new int[]{1, -1, 1, 0, 1, 0})) .withMessage("Digits may not be negative."); } - @DisplayName("invalid positive digit") @Disabled("Remove to run test") @Test + @DisplayName("invalid positive digit") public void testInvalidPositiveDigit() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> new BaseConverter(2, new int[]{1, 2, 1, 0, 1, 0})) .withMessage("All digits must be strictly less than the base."); } - @DisplayName("output base is one") @Disabled("Remove to run test") @Test + @DisplayName("output base is one") public void testSecondBaseIsOne() { BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0}); @@ -183,9 +183,9 @@ public void testSecondBaseIsOne() { .withMessage("Bases must be at least 2."); } - @DisplayName("output base is zero") @Disabled("Remove to run test") @Test + @DisplayName("output base is zero") public void testSecondBaseIsZero() { BaseConverter baseConverter = new BaseConverter(10, new int[]{7}); @@ -194,9 +194,9 @@ public void testSecondBaseIsZero() { .withMessage("Bases must be at least 2."); } - @DisplayName("output base is negative") @Disabled("Remove to run test") @Test + @DisplayName("output base is negative") public void testSecondBaseIsNegative() { BaseConverter baseConverter = new BaseConverter(2, new int[]{1}); diff --git a/exercises/practice/allergies/src/test/java/AllergiesTest.java b/exercises/practice/allergies/src/test/java/AllergiesTest.java index 3d0826647..cd0ae5cf7 100644 --- a/exercises/practice/allergies/src/test/java/AllergiesTest.java +++ b/exercises/practice/allergies/src/test/java/AllergiesTest.java @@ -9,44 +9,44 @@ public class AllergiesTest { // Testing for eggs allergy - @DisplayName("not allergic to anything") @Test + @DisplayName("not allergic to anything") public void eggsNotAllergicToAnything() { Allergies allergies = new Allergies(0); assertThat(allergies.isAllergicTo(Allergen.EGGS)).isFalse(); } - @DisplayName("allergic only to eggs") @Disabled("Remove to run test") @Test + @DisplayName("allergic only to eggs") public void eggsAllergicOnlyToEggs() { Allergies allergies = new Allergies(1); assertThat(allergies.isAllergicTo(Allergen.EGGS)).isTrue(); } - @DisplayName("allergic to eggs and something else") @Disabled("Remove to run test") @Test + @DisplayName("allergic to eggs and something else") public void eggsAllergicToEggsAndSomethingElse() { Allergies allergies = new Allergies(3); assertThat(allergies.isAllergicTo(Allergen.EGGS)).isTrue(); } - @DisplayName("allergic to something, but not eggs") @Disabled("Remove to run test") @Test + @DisplayName("allergic to something, but not eggs") public void eggsAllergicToSomethingButNotEggs() { Allergies allergies = new Allergies(2); assertThat(allergies.isAllergicTo(Allergen.EGGS)).isFalse(); } - @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test + @DisplayName("allergic to everything") public void eggsAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -56,44 +56,44 @@ public void eggsAllergicToEverything() { // Testing for peanuts allergy - @DisplayName("not allergic to anything") @Test + @DisplayName("not allergic to anything") public void peanutsNotAllergicToAnything() { Allergies allergies = new Allergies(0); assertThat(allergies.isAllergicTo(Allergen.PEANUTS)).isFalse(); } - @DisplayName("allergic only to peanuts") @Disabled("Remove to run test") @Test + @DisplayName("allergic only to peanuts") public void peanutsAllergicOnlyToPeanuts() { Allergies allergies = new Allergies(2); assertThat(allergies.isAllergicTo(Allergen.PEANUTS)).isTrue(); } - @DisplayName("allergic to peanuts and something else") @Disabled("Remove to run test") @Test + @DisplayName("allergic to peanuts and something else") public void peanutsAllergicToPeanutsAndSomethingElse() { Allergies allergies = new Allergies(7); assertThat(allergies.isAllergicTo(Allergen.PEANUTS)).isTrue(); } - @DisplayName("allergic to something, but not peanuts") @Disabled("Remove to run test") @Test + @DisplayName("allergic to something, but not peanuts") public void peanutsAllergicToSomethingButNotPeanuts() { Allergies allergies = new Allergies(5); assertThat(allergies.isAllergicTo(Allergen.PEANUTS)).isFalse(); } - @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test + @DisplayName("allergic to everything") public void peanutsAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -103,44 +103,44 @@ public void peanutsAllergicToEverything() { // Testing for shellfish allergy - @DisplayName("not allergic to anything") @Test + @DisplayName("not allergic to anything") public void shellfishNotAllergicToAnything() { Allergies allergies = new Allergies(0); assertThat(allergies.isAllergicTo(Allergen.SHELLFISH)).isFalse(); } - @DisplayName("allergic only to shellfish") @Disabled("Remove to run test") @Test + @DisplayName("allergic only to shellfish") public void shellfishAllergicOnlyToShellfish() { Allergies allergies = new Allergies(4); assertThat(allergies.isAllergicTo(Allergen.SHELLFISH)).isTrue(); } - @DisplayName("allergic to shellfish and something else") @Disabled("Remove to run test") @Test + @DisplayName("allergic to shellfish and something else") public void shellfishAllergicToShellfishAndSomethingElse() { Allergies allergies = new Allergies(14); assertThat(allergies.isAllergicTo(Allergen.SHELLFISH)).isTrue(); } - @DisplayName("allergic to something, but not shellfish") @Disabled("Remove to run test") @Test + @DisplayName("allergic to something, but not shellfish") public void shellfishAllergicToSomethingButNotShellfish() { Allergies allergies = new Allergies(10); assertThat(allergies.isAllergicTo(Allergen.SHELLFISH)).isFalse(); } - @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test + @DisplayName("allergic to everything") public void shellfishAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -150,44 +150,44 @@ public void shellfishAllergicToEverything() { // Testing for strawberries allergy - @DisplayName("not allergic to anything") @Test + @DisplayName("not allergic to anything") public void strawberriesNotAllergicToAnything() { Allergies allergies = new Allergies(0); assertThat(allergies.isAllergicTo(Allergen.STRAWBERRIES)).isFalse(); } - @DisplayName("allergic only to strawberries") @Disabled("Remove to run test") @Test + @DisplayName("allergic only to strawberries") public void strawberriesAllergicOnlyToStrawberries() { Allergies allergies = new Allergies(8); assertThat(allergies.isAllergicTo(Allergen.STRAWBERRIES)).isTrue(); } - @DisplayName("allergic to strawberries and something else") @Disabled("Remove to run test") @Test + @DisplayName("allergic to strawberries and something else") public void strawberriesAllergicToStrawberriesAndSomethingElse() { Allergies allergies = new Allergies(28); assertThat(allergies.isAllergicTo(Allergen.STRAWBERRIES)).isTrue(); } - @DisplayName("allergic to something, but not strawberries") @Disabled("Remove to run test") @Test + @DisplayName("allergic to something, but not strawberries") public void strawberriesAllergicToSomethingButNotStrawberries() { Allergies allergies = new Allergies(20); assertThat(allergies.isAllergicTo(Allergen.STRAWBERRIES)).isFalse(); } - @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test + @DisplayName("allergic to everything") public void strawberriesAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -197,44 +197,44 @@ public void strawberriesAllergicToEverything() { // Testing for tomatoes allergy - @DisplayName("not allergic to anything") @Test + @DisplayName("not allergic to anything") public void tomatoesNotAllergicToAnything() { Allergies allergies = new Allergies(0); assertThat(allergies.isAllergicTo(Allergen.TOMATOES)).isFalse(); } - @DisplayName("allergic only to tomatoes") @Disabled("Remove to run test") @Test + @DisplayName("allergic only to tomatoes") public void tomatoesAllergicOnlyToTomatoes() { Allergies allergies = new Allergies(16); assertThat(allergies.isAllergicTo(Allergen.TOMATOES)).isTrue(); } - @DisplayName("allergic to tomatoes and something else") @Disabled("Remove to run test") @Test + @DisplayName("allergic to tomatoes and something else") public void tomatoesAllergicToTomatoesAndSomethingElse() { Allergies allergies = new Allergies(56); assertThat(allergies.isAllergicTo(Allergen.TOMATOES)).isTrue(); } - @DisplayName("allergic to something, but not tomatoes") @Disabled("Remove to run test") @Test + @DisplayName("allergic to something, but not tomatoes") public void tomatoesAllergicToSomethingButNotTomatoes() { Allergies allergies = new Allergies(40); assertThat(allergies.isAllergicTo(Allergen.TOMATOES)).isFalse(); } - @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test + @DisplayName("allergic to everything") public void tomatoesAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -244,44 +244,44 @@ public void tomatoesAllergicToEverything() { // Testing for chocolate allergy - @DisplayName("not allergic to anything") @Test + @DisplayName("not allergic to anything") public void chocolateNotAllergicToAnything() { Allergies allergies = new Allergies(0); assertThat(allergies.isAllergicTo(Allergen.CHOCOLATE)).isFalse(); } - @DisplayName("allergic only to chocolate") @Disabled("Remove to run test") @Test + @DisplayName("allergic only to chocolate") public void chocolateAllergicOnlyToChocolate() { Allergies allergies = new Allergies(32); assertThat(allergies.isAllergicTo(Allergen.CHOCOLATE)).isTrue(); } - @DisplayName("allergic to chocolate and something else") @Disabled("Remove to run test") @Test + @DisplayName("allergic to chocolate and something else") public void chocolateAllergicToChocolateAndSomethingElse() { Allergies allergies = new Allergies(112); assertThat(allergies.isAllergicTo(Allergen.CHOCOLATE)).isTrue(); } - @DisplayName("allergic to something, but not chocolate") @Disabled("Remove to run test") @Test + @DisplayName("allergic to something, but not chocolate") public void chocolateAllergicToSomethingButNotChocolate() { Allergies allergies = new Allergies(80); assertThat(allergies.isAllergicTo(Allergen.CHOCOLATE)).isFalse(); } - @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test + @DisplayName("allergic to everything") public void chocolateAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -291,44 +291,44 @@ public void chocolateAllergicToEverything() { // Testing for pollen allergy - @DisplayName("not allergic to anything") @Test + @DisplayName("not allergic to anything") public void pollenNotAllergicToAnything() { Allergies allergies = new Allergies(0); assertThat(allergies.isAllergicTo(Allergen.POLLEN)).isFalse(); } - @DisplayName("allergic only to pollen") @Disabled("Remove to run test") @Test + @DisplayName("allergic only to pollen") public void pollenAllergicOnlyToPollen() { Allergies allergies = new Allergies(64); assertThat(allergies.isAllergicTo(Allergen.POLLEN)).isTrue(); } - @DisplayName("allergic to pollen and something else") @Disabled("Remove to run test") @Test + @DisplayName("allergic to pollen and something else") public void pollenAllergicToPollenAndSomethingElse() { Allergies allergies = new Allergies(224); assertThat(allergies.isAllergicTo(Allergen.POLLEN)).isTrue(); } - @DisplayName("allergic to something, but not pollen") @Disabled("Remove to run test") @Test + @DisplayName("allergic to something, but not pollen") public void pollenAllergicToSomethingButNotPollen() { Allergies allergies = new Allergies(160); assertThat(allergies.isAllergicTo(Allergen.POLLEN)).isFalse(); } - @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test + @DisplayName("allergic to everything") public void pollenAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -338,44 +338,44 @@ public void pollenAllergicToEverything() { // Testing for cats allergy - @DisplayName("not allergic to anything") @Test + @DisplayName("not allergic to anything") public void catsNotAllergicToAnything() { Allergies allergies = new Allergies(0); assertThat(allergies.isAllergicTo(Allergen.CATS)).isFalse(); } - @DisplayName("allergic only to cats") @Disabled("Remove to run test") @Test + @DisplayName("allergic only to cats") public void catsAllergicOnlyToCats() { Allergies allergies = new Allergies(128); assertThat(allergies.isAllergicTo(Allergen.CATS)).isTrue(); } - @DisplayName("allergic to cats and something else") @Disabled("Remove to run test") @Test + @DisplayName("allergic to cats and something else") public void catsAllergicToCatsAndSomethingElse() { Allergies allergies = new Allergies(192); assertThat(allergies.isAllergicTo(Allergen.CATS)).isTrue(); } - @DisplayName("allergic to something, but not cats") @Disabled("Remove to run test") @Test + @DisplayName("allergic to something, but not cats") public void catsAllergicToSomethingButNotCats() { Allergies allergies = new Allergies(64); assertThat(allergies.isAllergicTo(Allergen.CATS)).isFalse(); } - @DisplayName("allergic to everything") @Disabled("Remove to run test") @Test + @DisplayName("allergic to everything") public void catsAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -385,18 +385,18 @@ public void catsAllergicToEverything() { // Testing listing allergies - @DisplayName("no allergies") @Disabled("Remove to run test") @Test + @DisplayName("no allergies") public void listNoAllergies() { Allergies allergies = new Allergies(0); assertThat(allergies.getList().size()).isEqualTo(0); } - @DisplayName("just eggs") @Disabled("Remove to run test") @Test + @DisplayName("just eggs") public void listJustEggs() { Allergies allergies = new Allergies(1); @@ -404,9 +404,9 @@ public void listJustEggs() { .containsExactly(Allergen.EGGS); } - @DisplayName("just peanuts") @Disabled("Remove to run test") @Test + @DisplayName("just peanuts") public void listJustPeanuts() { Allergies allergies = new Allergies(2); @@ -414,9 +414,9 @@ public void listJustPeanuts() { .containsExactly(Allergen.PEANUTS); } - @DisplayName("just strawberries") @Disabled("Remove to run test") @Test + @DisplayName("just strawberries") public void listJustStrawberries() { Allergies allergies = new Allergies(8); @@ -424,9 +424,9 @@ public void listJustStrawberries() { .containsExactly(Allergen.STRAWBERRIES); } - @DisplayName("eggs and peanuts") @Disabled("Remove to run test") @Test + @DisplayName("eggs and peanuts") public void listEggsAndPeanuts() { Allergies allergies = new Allergies(3); @@ -436,9 +436,9 @@ public void listEggsAndPeanuts() { Allergen.PEANUTS); } - @DisplayName("more than eggs but not peanuts") @Disabled("Remove to run test") @Test + @DisplayName("more than eggs but not peanuts") public void listoMoreThanEggsButNotPeanuts() { Allergies allergies = new Allergies(5); @@ -448,9 +448,9 @@ public void listoMoreThanEggsButNotPeanuts() { Allergen.SHELLFISH); } - @DisplayName("lots of stuff") @Disabled("Remove to run test") @Test + @DisplayName("lots of stuff") public void listManyAllergies() { Allergies allergies = new Allergies(248); @@ -463,9 +463,9 @@ public void listManyAllergies() { Allergen.CATS); } - @DisplayName("everything") @Disabled("Remove to run test") @Test + @DisplayName("everything") public void listEverything() { Allergies allergies = new Allergies(255); @@ -481,9 +481,9 @@ public void listEverything() { Allergen.CATS); } - @DisplayName("no allergen score parts") @Disabled("Remove to run test") @Test + @DisplayName("no allergen score parts") public void listNoAllergenScoreParts() { Allergies allergies = new Allergies(509); @@ -498,9 +498,9 @@ public void listNoAllergenScoreParts() { Allergen.CATS); } - @DisplayName("no allergen score parts without highest valid score") @Disabled("Remove to run test") @Test + @DisplayName("no allergen score parts without highest valid score") public void listNoAllergenScorePartsWithoutHighestValidScore() { Allergies allergies = new Allergies(257); From ac4aeb208ccc14f524fa4a958dca0c8a051849cd Mon Sep 17 00:00:00 2001 From: Atharv Patil Date: Wed, 27 Aug 2025 14:39:17 +0530 Subject: [PATCH 3/4] Change import order --- exercises/practice/acronym/src/test/java/AcronymTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/practice/acronym/src/test/java/AcronymTest.java b/exercises/practice/acronym/src/test/java/AcronymTest.java index e4b572d2f..3d81aa1eb 100644 --- a/exercises/practice/acronym/src/test/java/AcronymTest.java +++ b/exercises/practice/acronym/src/test/java/AcronymTest.java @@ -1,6 +1,7 @@ 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; From 97ff91f6ea0ea7c97b398237cac77091c9a20a71 Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Wed, 27 Aug 2025 14:48:19 +0530 Subject: [PATCH 4/4] Update AcronymTest.java --- exercises/practice/acronym/src/test/java/AcronymTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/exercises/practice/acronym/src/test/java/AcronymTest.java b/exercises/practice/acronym/src/test/java/AcronymTest.java index 3d81aa1eb..09b419c4a 100644 --- a/exercises/practice/acronym/src/test/java/AcronymTest.java +++ b/exercises/practice/acronym/src/test/java/AcronymTest.java @@ -2,11 +2,9 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; - import static org.assertj.core.api.Assertions.assertThat; public class AcronymTest { - @Test @DisplayName("basic")