Skip to content

Update exception type in SavingsAccount tests #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/test/java/oving7/savingsaccount/ForeldreSparTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void testWithdraw() {

assertEquals(9000, foreldreSpar.getBalance(), epsilon, "The account balance is incorrect");

assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalStateException.class, () -> {
foreldreSpar.withdraw(10_000);
}, "Should not be able to withdraw more money than is in the account");

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/oving7/savingsaccount/SavingsAccountTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public void testDepositAndWithdrawIllegalInput() {

savingsAccount.deposit(10.0);

assertThrows(IllegalArgumentException.class, () -> {
assertThrows(IllegalStateException.class, () -> {
savingsAccount.withdraw(40.0);
}, "Withdrawal of more than the balance should have triggered an IllegalArgumentException");
}, "Withdrawal of more than the balance should have triggered an IllegalStateException");

assertEquals(30.0, savingsAccount.getBalance(), epsilon,
"The account balance was incorrect");
Expand Down