diff --git a/exercises/practice/bank-account/src/test/java/BankAccountTest.java b/exercises/practice/bank-account/src/test/java/BankAccountTest.java index 35b4e04a0..8c6d65de7 100644 --- a/exercises/practice/bank-account/src/test/java/BankAccountTest.java +++ b/exercises/practice/bank-account/src/test/java/BankAccountTest.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.Random; @@ -15,6 +16,7 @@ public void setUp() { } @Test + @DisplayName("Newly opened account has zero balance") public void newlyOpenedAccountHasEmptyBalance() throws BankAccountActionInvalidException { bankAccount.open(); @@ -23,6 +25,7 @@ public void newlyOpenedAccountHasEmptyBalance() throws BankAccountActionInvalidE @Disabled("Remove to run test") @Test + @DisplayName("Single deposit") public void singleDeposit() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.deposit(100); @@ -32,6 +35,7 @@ public void singleDeposit() throws BankAccountActionInvalidException { @Disabled("Remove to run test") @Test + @DisplayName("Multiple deposits") public void multipleDeposits() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.deposit(100); @@ -42,6 +46,7 @@ public void multipleDeposits() throws BankAccountActionInvalidException { @Disabled("Remove to run test") @Test + @DisplayName("Withdraw once") public void withdrawOnce() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.deposit(100); @@ -52,6 +57,7 @@ public void withdrawOnce() throws BankAccountActionInvalidException { @Disabled("Remove to run test") @Test + @DisplayName("Withdraw twice") public void withdrawTwice() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.deposit(100); @@ -63,6 +69,7 @@ public void withdrawTwice() throws BankAccountActionInvalidException { @Disabled("Remove to run test") @Test + @DisplayName("Can do multiple operations sequentially") public void canDoMultipleOperationsSequentially() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.deposit(100); @@ -76,6 +83,7 @@ public void canDoMultipleOperationsSequentially() throws BankAccountActionInvali @Disabled("Remove to run test") @Test + @DisplayName("Cannot check balance of closed account") public void cannotCheckBalanceOfClosedAccount() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.close(); @@ -87,6 +95,7 @@ public void cannotCheckBalanceOfClosedAccount() throws BankAccountActionInvalidE @Disabled("Remove to run test") @Test + @DisplayName("Cannot deposit into closed account") public void cannotDepositIntoClosedAccount() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.close(); @@ -98,6 +107,7 @@ public void cannotDepositIntoClosedAccount() throws BankAccountActionInvalidExce @Disabled("Remove to run test") @Test + @DisplayName("Cannot deposit into unopened account") public void cannotDepositIntoUnopenedAccount() { assertThatExceptionOfType(BankAccountActionInvalidException.class) .isThrownBy(() -> bankAccount.deposit(50)) @@ -106,6 +116,7 @@ public void cannotDepositIntoUnopenedAccount() { @Disabled("Remove to run test") @Test + @DisplayName("Cannot withdraw from closed account") public void cannotWithdrawFromClosedAccount() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.close(); @@ -117,6 +128,7 @@ public void cannotWithdrawFromClosedAccount() throws BankAccountActionInvalidExc @Disabled("Remove to run test") @Test + @DisplayName("Cannot close an account that was not opened") public void cannotCloseAnAccountThatWasNotOpened() { assertThatExceptionOfType(BankAccountActionInvalidException.class) .isThrownBy(bankAccount::close) @@ -125,6 +137,7 @@ public void cannotCloseAnAccountThatWasNotOpened() { @Disabled("Remove to run test") @Test + @DisplayName("Cannot open an already opened account") public void cannotOpenAnAlreadyOpenedAccount() throws BankAccountActionInvalidException { bankAccount.open(); @@ -135,6 +148,7 @@ public void cannotOpenAnAlreadyOpenedAccount() throws BankAccountActionInvalidEx @Disabled("Remove to run test") @Test + @DisplayName("Reopened account does not retain balance") public void reopenedAccountDoesNotRetainBalance() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.deposit(50); @@ -146,7 +160,8 @@ public void reopenedAccountDoesNotRetainBalance() throws BankAccountActionInvali @Disabled("Remove to run test") @Test - public void cannotWithdrawMoreThanWasDeposited() throws BankAccountActionInvalidException { + @DisplayName("Cannot withdraw more than deposited") + public void cannotWithdrawMoreThanDeposited() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.deposit(25); @@ -157,6 +172,7 @@ public void cannotWithdrawMoreThanWasDeposited() throws BankAccountActionInvalid @Disabled("Remove to run test") @Test + @DisplayName("Cannot withdraw negative") public void cannotWithdrawNegativeAmount() throws BankAccountActionInvalidException { bankAccount.open(); bankAccount.deposit(100); @@ -168,6 +184,7 @@ public void cannotWithdrawNegativeAmount() throws BankAccountActionInvalidExcept @Disabled("Remove to run test") @Test + @DisplayName("Cannot deposit negative") public void cannotDepositNegativeAmount() throws BankAccountActionInvalidException { bankAccount.open(); @@ -178,6 +195,7 @@ public void cannotDepositNegativeAmount() throws BankAccountActionInvalidExcepti @Disabled("Remove to run test") @Test + @DisplayName("Can handle concurrent transactions") public void canHandleConcurrentTransactions() throws BankAccountActionInvalidException, InterruptedException { bankAccount.open(); bankAccount.deposit(1000); diff --git a/exercises/practice/binary-search-tree/src/test/java/BinarySearchTreeTest.java b/exercises/practice/binary-search-tree/src/test/java/BinarySearchTreeTest.java index 1d16df93c..f6d8f1478 100644 --- a/exercises/practice/binary-search-tree/src/test/java/BinarySearchTreeTest.java +++ b/exercises/practice/binary-search-tree/src/test/java/BinarySearchTreeTest.java @@ -4,11 +4,13 @@ import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; public class BinarySearchTreeTest { @Test + @DisplayName("data is retained") public void dataIsRetained() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); @@ -24,6 +26,7 @@ public void dataIsRetained() { @Disabled("Remove to run test") @Test + @DisplayName("insert data at proper node") public void insertsLess() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); @@ -45,6 +48,7 @@ public void insertsLess() { @Disabled("Remove to run test") @Test + @DisplayName("same number at left node") public void insertsSame() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); String expectedRoot = "4"; @@ -65,6 +69,7 @@ public void insertsSame() { @Disabled("Remove to run test") @Test + @DisplayName("greater number at right node") public void insertsRight() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); int expectedRoot = 4; @@ -85,6 +90,7 @@ public void insertsRight() { @Disabled("Remove to run test") @Test + @DisplayName("can create complex tree") public void createsComplexTree() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); List expected = List.of('4', '2', '6', '1', '3', '5', '7'); @@ -97,6 +103,7 @@ public void createsComplexTree() { @Disabled("Remove to run test") @Test + @DisplayName("can sort single number") public void sortsSingleElement() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); List expected = Collections.singletonList("2"); @@ -108,6 +115,7 @@ public void sortsSingleElement() { @Disabled("Remove to run test") @Test + @DisplayName("can sort if second number is smaller than first") public void sortsCollectionOfTwoIfSecondInsertedIsSmallerThanFirst() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); List expected = List.of(1, 2); @@ -120,6 +128,7 @@ public void sortsCollectionOfTwoIfSecondInsertedIsSmallerThanFirst() { @Disabled("Remove to run test") @Test + @DisplayName("can sort if second number is same as first") public void sortsCollectionOfTwoIfSecondNumberisSameAsFirst() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); List expected = List.of('2', '2'); @@ -132,6 +141,7 @@ public void sortsCollectionOfTwoIfSecondNumberisSameAsFirst() { @Disabled("Remove to run test") @Test + @DisplayName("can sort if second number is greater than first") public void sortsCollectionOfTwoIfSecondInsertedIsBiggerThanFirst() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); List expected = List.of('2', '3'); @@ -144,6 +154,7 @@ public void sortsCollectionOfTwoIfSecondInsertedIsBiggerThanFirst() { @Disabled("Remove to run test") @Test + @DisplayName("can sort complex tree") public void iteratesOverComplexTree() { BinarySearchTree binarySearchTree = new BinarySearchTree<>(); List expected = List.of("1", "2", "3", "5", "6", "7"); diff --git a/exercises/practice/binary-search/src/test/java/BinarySearchTest.java b/exercises/practice/binary-search/src/test/java/BinarySearchTest.java index f586f744c..4846489c9 100644 --- a/exercises/practice/binary-search/src/test/java/BinarySearchTest.java +++ b/exercises/practice/binary-search/src/test/java/BinarySearchTest.java @@ -2,6 +2,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.Collections; @@ -10,6 +11,7 @@ public class BinarySearchTest { @Test + @DisplayName("finds a value in an array with one element") public void findsAValueInAnArrayWithOneElement() throws ValueNotFoundException { List listOfUnitLength = Collections.singletonList(6); @@ -20,6 +22,7 @@ public void findsAValueInAnArrayWithOneElement() throws ValueNotFoundException { @Disabled("Remove to run test") @Test + @DisplayName("finds a value in the middle of an array") public void findsAValueInTheMiddleOfAnArray() throws ValueNotFoundException { List sortedList = List.of(1, 3, 4, 6, 8, 9, 11); @@ -30,6 +33,7 @@ public void findsAValueInTheMiddleOfAnArray() throws ValueNotFoundException { @Disabled("Remove to run test") @Test + @DisplayName("finds a value at the beginning of an array") public void findsAValueAtTheBeginningOfAnArray() throws ValueNotFoundException { List sortedList = List.of(1, 3, 4, 6, 8, 9, 11); @@ -40,6 +44,7 @@ public void findsAValueAtTheBeginningOfAnArray() throws ValueNotFoundException { @Disabled("Remove to run test") @Test + @DisplayName("finds a value at the end of an array") public void findsAValueAtTheEndOfAnArray() throws ValueNotFoundException { List sortedList = List.of(1, 3, 4, 6, 8, 9, 11); @@ -50,6 +55,7 @@ public void findsAValueAtTheEndOfAnArray() throws ValueNotFoundException { @Disabled("Remove to run test") @Test + @DisplayName("finds a value in an array of odd length") public void findsAValueInAnArrayOfOddLength() throws ValueNotFoundException { List sortedListOfOddLength = List.of(1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634); @@ -60,6 +66,7 @@ public void findsAValueInAnArrayOfOddLength() throws ValueNotFoundException { @Disabled("Remove to run test") @Test + @DisplayName("finds a value in an array of even length") public void findsAValueInAnArrayOfEvenLength() throws ValueNotFoundException { List sortedListOfEvenLength = List.of(1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377); @@ -70,6 +77,7 @@ public void findsAValueInAnArrayOfEvenLength() throws ValueNotFoundException { @Disabled("Remove to run test") @Test + @DisplayName("identifies that a value is not included in the array") public void identifiesThatAValueIsNotFoundInTheArray() { List sortedList = List.of(1, 3, 4, 6, 8, 9, 11); @@ -82,6 +90,7 @@ public void identifiesThatAValueIsNotFoundInTheArray() { @Disabled("Remove to run test") @Test + @DisplayName("a value smaller than the array's smallest value is not found") public void aValueSmallerThanTheArraysSmallestValueIsNotFound() { List sortedList = List.of(1, 3, 4, 6, 8, 9, 11); @@ -94,6 +103,7 @@ public void aValueSmallerThanTheArraysSmallestValueIsNotFound() { @Disabled("Remove to run test") @Test + @DisplayName("a value larger than the array's largest value is not found") public void aValueLargerThanTheArraysLargestValueIsNotFound() throws ValueNotFoundException { List sortedList = List.of(1, 3, 4, 6, 8, 9, 11); @@ -106,6 +116,7 @@ public void aValueLargerThanTheArraysLargestValueIsNotFound() throws ValueNotFou @Disabled("Remove to run test") @Test + @DisplayName("nothing is found in an empty array") public void nothingIsFoundInAnEmptyArray() throws ValueNotFoundException { List emptyList = Collections.emptyList(); @@ -118,6 +129,7 @@ public void nothingIsFoundInAnEmptyArray() throws ValueNotFoundException { @Disabled("Remove to run test") @Test + @DisplayName("nothing is found when the left and right bounds cross") public void nothingIsFoundWhenTheLeftAndRightBoundCross() throws ValueNotFoundException { List sortedList = List.of(1, 2); diff --git a/exercises/practice/bob/src/test/java/BobTest.java b/exercises/practice/bob/src/test/java/BobTest.java index 801315b42..756fb93f8 100644 --- a/exercises/practice/bob/src/test/java/BobTest.java +++ b/exercises/practice/bob/src/test/java/BobTest.java @@ -1,5 +1,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.BeforeEach; import static org.assertj.core.api.Assertions.assertThat; @@ -14,6 +15,7 @@ public void setUp() { } @Test + @DisplayName("stating something") public void saySomething() { assertThat(bob.hey("Tom-ay-to, tom-aaaah-to.")) .isEqualTo("Whatever."); @@ -21,6 +23,7 @@ public void saySomething() { @Disabled("Remove to run test") @Test + @DisplayName("shouting") public void shouting() { assertThat(bob.hey("WATCH OUT!")) .isEqualTo("Whoa, chill out!"); @@ -28,6 +31,7 @@ public void shouting() { @Disabled("Remove to run test") @Test + @DisplayName("shouting gibberish") public void shoutingGibberish() { assertThat(bob.hey("FCECDFCAAB")) .isEqualTo("Whoa, chill out!"); @@ -35,6 +39,7 @@ public void shoutingGibberish() { @Disabled("Remove to run test") @Test + @DisplayName("asking a question") public void askingAQuestion() { assertThat(bob.hey("Does this cryogenic chamber make me look fat?")) .isEqualTo("Sure."); @@ -42,6 +47,7 @@ public void askingAQuestion() { @Disabled("Remove to run test") @Test + @DisplayName("asking a numeric question") public void askingANumericQuestion() { assertThat(bob.hey("You are, what, like 15?")) .isEqualTo("Sure."); @@ -49,6 +55,7 @@ public void askingANumericQuestion() { @Disabled("Remove to run test") @Test + @DisplayName("asking gibberish") public void askingGibberish() { assertThat(bob.hey("fffbbcbeab?")) .isEqualTo("Sure."); @@ -56,6 +63,7 @@ public void askingGibberish() { @Disabled("Remove to run test") @Test + @DisplayName("talking forcefully") public void talkingForcefully() { assertThat(bob.hey("Hi there!")) .isEqualTo("Whatever."); @@ -63,6 +71,7 @@ public void talkingForcefully() { @Disabled("Remove to run test") @Test + @DisplayName("using acronyms in regular speech") public void usingAcronymsInRegularSpeech() { assertThat(bob.hey("It's OK if you don't want to go work for NASA.")) .isEqualTo("Whatever."); @@ -70,6 +79,7 @@ public void usingAcronymsInRegularSpeech() { @Disabled("Remove to run test") @Test + @DisplayName("forceful question") public void forcefulQuestions() { assertThat(bob.hey("WHAT'S GOING ON?")) .isEqualTo("Calm down, I know what I'm doing!"); @@ -77,6 +87,7 @@ public void forcefulQuestions() { @Disabled("Remove to run test") @Test + @DisplayName("shouting numbers") public void shoutingNumbers() { assertThat(bob.hey("1, 2, 3 GO!")) .isEqualTo("Whoa, chill out!"); @@ -84,6 +95,7 @@ public void shoutingNumbers() { @Disabled("Remove to run test") @Test + @DisplayName("no letters") public void onlyNumbers() { assertThat(bob.hey("1, 2, 3")) .isEqualTo("Whatever."); @@ -91,6 +103,7 @@ public void onlyNumbers() { @Disabled("Remove to run test") @Test + @DisplayName("question with no letters") public void questionWithOnlyNumbers() { assertThat(bob.hey("4?")) .isEqualTo("Sure."); @@ -98,6 +111,7 @@ public void questionWithOnlyNumbers() { @Disabled("Remove to run test") @Test + @DisplayName("shouting with special characters") public void shoutingWithSpecialCharacters() { assertThat(bob.hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")) .isEqualTo("Whoa, chill out!"); @@ -105,6 +119,7 @@ public void shoutingWithSpecialCharacters() { @Disabled("Remove to run test") @Test + @DisplayName("shouting with no exclamation mark") public void shoutingWithNoExclamationMark() { assertThat(bob.hey("I HATE THE DENTIST")) .isEqualTo("Whoa, chill out!"); @@ -112,6 +127,7 @@ public void shoutingWithNoExclamationMark() { @Disabled("Remove to run test") @Test + @DisplayName("statement containing question mark") public void statementContainingQuestionMark() { assertThat(bob.hey("Ending with ? means a question.")) .isEqualTo("Whatever."); @@ -119,6 +135,7 @@ public void statementContainingQuestionMark() { @Disabled("Remove to run test") @Test + @DisplayName("non-letters with question") public void nonLettersWithQuestion() { assertThat(bob.hey(":) ?")) .isEqualTo("Sure."); @@ -126,6 +143,7 @@ public void nonLettersWithQuestion() { @Disabled("Remove to run test") @Test + @DisplayName("prattling on") public void prattlingOn() { assertThat(bob.hey("Wait! Hang on. Are you going to be OK?")) .isEqualTo("Sure."); @@ -133,6 +151,7 @@ public void prattlingOn() { @Disabled("Remove to run test") @Test + @DisplayName("silence") public void silence() { assertThat(bob.hey("")) .isEqualTo("Fine. Be that way!"); @@ -140,6 +159,7 @@ public void silence() { @Disabled("Remove to run test") @Test + @DisplayName("prolonged silence") public void prolongedSilence() { assertThat(bob.hey(" ")) .isEqualTo("Fine. Be that way!"); @@ -147,6 +167,7 @@ public void prolongedSilence() { @Disabled("Remove to run test") @Test + @DisplayName("alternate silence") public void alternateSilence() { assertThat(bob.hey("\t\t\t\t\t\t\t\t\t\t")) .isEqualTo("Fine. Be that way!"); @@ -154,6 +175,7 @@ public void alternateSilence() { @Disabled("Remove to run test") @Test + @DisplayName("starting with whitespace") public void startingWithWhitespace() { assertThat(bob.hey(" hmmmmmmm...")) .isEqualTo("Whatever."); @@ -161,6 +183,7 @@ public void startingWithWhitespace() { @Disabled("Remove to run test") @Test + @DisplayName("ending with whitespace") public void endingWithWhiteSpace() { assertThat(bob.hey("Okay if like my spacebar quite a bit? ")) .isEqualTo("Sure."); @@ -168,6 +191,7 @@ public void endingWithWhiteSpace() { @Disabled("Remove to run test") @Test + @DisplayName("other whitespace") public void otherWhiteSpace() { assertThat(bob.hey("\n\r \t")) .isEqualTo("Fine. Be that way!"); @@ -175,6 +199,7 @@ public void otherWhiteSpace() { @Disabled("Remove to run test") @Test + @DisplayName("non-question ending with whitespace") public void nonQuestionEndingWithWhiteSpace() { assertThat(bob.hey("This is a statement ending with whitespace ")) .isEqualTo("Whatever."); @@ -182,6 +207,7 @@ public void nonQuestionEndingWithWhiteSpace() { @Disabled("Remove to run test") @Test + @DisplayName("multiple line question") public void multipleLineQuestion() { assertThat(bob.hey("\nDoes this cryogenic chamber make\n me look fat?")) .isEqualTo("Sure."); diff --git a/exercises/practice/book-store/src/test/java/BookStoreTest.java b/exercises/practice/book-store/src/test/java/BookStoreTest.java index 920b83658..bbcbbcfb9 100644 --- a/exercises/practice/book-store/src/test/java/BookStoreTest.java +++ b/exercises/practice/book-store/src/test/java/BookStoreTest.java @@ -1,6 +1,7 @@ import org.assertj.core.api.Assertions; 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.Arrays; @@ -23,6 +24,7 @@ public void setUp() { } @Test + @DisplayName("Only a single book") public void onlyASingleBook() { List books = Collections.singletonList(1); assertThat(bookStore.calculateBasketCost(books)) @@ -31,6 +33,7 @@ public void onlyASingleBook() { @Disabled("Remove to run test") @Test + @DisplayName("Two of the same book") public void twoOfSameBook() { List books = Arrays.asList(2, 2); assertThat(bookStore.calculateBasketCost(books)) @@ -39,6 +42,7 @@ public void twoOfSameBook() { @Disabled("Remove to run test") @Test + @DisplayName("Empty basket") public void emptyBasket() { List books = Collections.emptyList(); assertThat(bookStore.calculateBasketCost(books)) @@ -47,6 +51,7 @@ public void emptyBasket() { @Disabled("Remove to run test") @Test + @DisplayName("Two different books") public void twoDifferentBooks() { List books = Arrays.asList(1, 2); assertThat(bookStore.calculateBasketCost(books)) @@ -55,6 +60,7 @@ public void twoDifferentBooks() { @Disabled("Remove to run test") @Test + @DisplayName("Three different books") public void threeDifferentBooks() { List books = Arrays.asList(1, 2, 3); assertThat(bookStore.calculateBasketCost(books)) @@ -63,6 +69,7 @@ public void threeDifferentBooks() { @Disabled("Remove to run test") @Test + @DisplayName("Four different books") public void fourDifferentBooks() { List books = Arrays.asList(1, 2, 3, 4); assertThat(bookStore.calculateBasketCost(books)) @@ -71,6 +78,7 @@ public void fourDifferentBooks() { @Disabled("Remove to run test") @Test + @DisplayName("Five different books") public void fiveDifferentBooks() { List books = Arrays.asList(1, 2, 3, 4, 5); assertThat(bookStore.calculateBasketCost(books)) @@ -79,6 +87,7 @@ public void fiveDifferentBooks() { @Disabled("Remove to run test") @Test + @DisplayName("Two groups of four is cheaper than group of five plus group of three") public void twoGroupsOfFourIsCheaperThanGroupOfFivePlusGroupOfThree() { List books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 5); assertThat(bookStore.calculateBasketCost(books)) @@ -87,6 +96,7 @@ public void twoGroupsOfFourIsCheaperThanGroupOfFivePlusGroupOfThree() { @Disabled("Remove to run test") @Test + @DisplayName("Two groups of four is cheaper than groups of five and three") public void twoGroupsOfFourIsCheaperThanGroupsOfFiveAndThree() { List books = Arrays.asList(1, 1, 2, 3, 4, 4, 5, 5); assertThat(bookStore.calculateBasketCost(books)) @@ -95,6 +105,7 @@ public void twoGroupsOfFourIsCheaperThanGroupsOfFiveAndThree() { @Disabled("Remove to run test") @Test + @DisplayName("Group of four plus group of two is cheaper than two groups of three") public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree() { List books = Arrays.asList(1, 1, 2, 2, 3, 4); assertThat(bookStore.calculateBasketCost(books)) @@ -103,6 +114,7 @@ public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree() { @Disabled("Remove to run test") @Test + @DisplayName("Two each of first four books and one copy each of rest") public void twoEachOfFirst4BooksAnd1CopyEachOfRest() { List books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5); assertThat(bookStore.calculateBasketCost(books)) @@ -111,6 +123,7 @@ public void twoEachOfFirst4BooksAnd1CopyEachOfRest() { @Disabled("Remove to run test") @Test + @DisplayName("Two copies of each book") public void twoCopiesOfEachBook() { List books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5); assertThat(bookStore.calculateBasketCost(books)) @@ -119,7 +132,8 @@ public void twoCopiesOfEachBook() { @Disabled("Remove to run test") @Test - public void threeCopiesOfFirstBookAnd2EachOfRemaining() { + @DisplayName("Three copies of first book and two each of remaining") + public void threeCopiesOfFirstBookAndTwoEachOfRemaining() { List books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1); assertThat(bookStore.calculateBasketCost(books)) .isCloseTo(68.00, Assertions.offset(EQUALITY_TOLERANCE)); @@ -127,7 +141,8 @@ public void threeCopiesOfFirstBookAnd2EachOfRemaining() { @Disabled("Remove to run test") @Test - public void threeEachOFirst2BooksAnd2EachOfRemainingBooks() { + @DisplayName("Three each of first two books and two each of remaining books") + public void threeEachOfFirstTwoBooksAndTwoEachOfRemainingBooks() { List books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2); assertThat(bookStore.calculateBasketCost(books)) .isCloseTo(75.20, Assertions.offset(EQUALITY_TOLERANCE)); @@ -135,6 +150,7 @@ public void threeEachOFirst2BooksAnd2EachOfRemainingBooks() { @Disabled("Remove to run test") @Test + @DisplayName("Four groups of four are cheaper than two groups each of five and three") public void fourGroupsOfFourAreCheaperThanTwoGroupsEachOfFiveAndThree() { List books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5); assertThat(bookStore.calculateBasketCost(books)) @@ -143,6 +159,9 @@ public void fourGroupsOfFourAreCheaperThanTwoGroupsEachOfFiveAndThree() { @Disabled("Remove to run test") @Test + @DisplayName( + "Check that groups of four are created properly even when there are more groups of three than groups of five" + ) public void groupsOfFourAreCreatedEvenWhenThereAreMoreGroupsOfThreeThanGroupsOfFive() { List books = Arrays.asList(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5); assertThat(bookStore.calculateBasketCost(books)) @@ -151,6 +170,7 @@ public void groupsOfFourAreCreatedEvenWhenThereAreMoreGroupsOfThreeThanGroupsOfF @Disabled("Remove to run test") @Test + @DisplayName("One group of one and four is cheaper than one group of two and three") public void oneGroupOfOneAndFourIsCheaperThanOneGroupOfTwoAndThree() { List books = Arrays.asList(1, 1, 2, 3, 4); assertThat(bookStore.calculateBasketCost(books)) @@ -159,6 +179,7 @@ public void oneGroupOfOneAndFourIsCheaperThanOneGroupOfTwoAndThree() { @Disabled("Remove to run test") @Test + @DisplayName("One group of one and two plus three groups of four is cheaper than one group of each size") public void oneGroupOfOneAndTwoPlusThreeGroupsOfFourIsCheaperThanOneGroupOfEachSize() { List books = Arrays.asList(1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5); assertThat(bookStore.calculateBasketCost(books))