fix: savingsaccount tests exception type
This commit is contained in:
@@ -31,7 +31,7 @@ public class ForeldreSparTest {
|
||||
|
||||
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");
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ public class SavingsAccountTest {
|
||||
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user