Part 10 / Topic 12 of 12
Putting it together: the full suite, green
Everything in examples/bank-and-discount/ compiles and runs as one suite — seven production/support classes and two test classes, eighteen tests in total.
$ javac -cp ../lib/junit-platform-console-standalone-1.14.5.jar *.java
$ java -jar ../lib/junit-platform-console-standalone-1.14.5.jar execute -cp . --scan-class-path --details=tree --disable-ansi-colors
Thanks for using JUnit! Support its development at https://junit.org/sponsoring
Starting BankAccountTest suite
Finished BankAccountTest suite
╷
├─ JUnit Platform Suite ✔
├─ JUnit Jupiter ✔
│ ├─ BankAccountTest ✔
│ │ ├─ withdraw_lessThanBalance_decreasesBalance() ✔
│ │ ├─ withdraw_staysAboveThreshold_sendsNoAlert() ✔
│ │ ├─ withdraw_moreThanBalance_throwsInsufficientFundsExceptionWithClearMessage() ✔
│ │ ├─ withdraw_takesBalanceBelowThreshold_sendsOneLowBalanceAlert() ✔
│ │ ├─ deposit_zeroOrNegative_throwsIllegalArgumentException() ✔
│ │ └─ deposit adds to the balance ✔
│ └─ DiscountCalculatorTest ✔
│ ├─ no discount still adds 18% GST ✔
│ ├─ finalPrice_negativePrice_throwsIllegalArgumentException() ✔
│ ├─ finalPrice_percentOffOutOfRange_throwsForEveryValue(double) ✔
│ │ ├─ percentOff -1.0 is out of range ✔
│ │ ├─ percentOff 100.5 is out of range ✔
│ │ └─ percentOff 250.0 is out of range ✔
│ ├─ finalPrice_groupedChecksOnOneBill() ✔
│ ├─ finalPrice_variousDiscounts_matchExpected(double, double, double) ✔
│ │ ├─ price 1000.0, 0.0% off -> 1180.0 ✔
│ │ ├─ price 1000.0, 20.0% off -> 944.0 ✔
│ │ ├─ price 1000.0, 50.0% off -> 590.0 ✔
│ │ └─ price 0.0, 20.0% off -> 0.0 ✔
│ ├─ finalPrice_percentOffAboveHundred_throwsIllegalArgumentException() ✔
│ └─ finalPrice_withPercentOff_discountsThenAddsGst() ✔
└─ JUnit Vintage ✔
Test run finished after 54 ms (varies)
[ 7 containers found ]
[ 7 containers successful ]
[ 18 tests found ]
[ 18 tests successful ]
[ 0 tests failed ]
Notice deposit adds to the balance (the one test with @DisplayName) sitting right next to five methods shown by their plain method names — both styles are legible in the same tree, which is exactly why Section 4 said to pick one rule per project rather than mixing freely. Every number in this tree — 7 containers, 18 tests, 0 failures — is the real count from this exact run, and matches BankAccountTest (6 tests) plus DiscountCalculatorTest (5 plain tests + 4 + 3 parameterized rows = 12), for 18.
Done here? The practice set for Part 10 — including the solutions — is on the part page.