fix: savingsaccount tests exception type

This commit is contained in:
Andreas Omholt Olsen
2026-03-13 14:39:39 +01:00
parent daa94740c8
commit 2d0a64006f
2 changed files with 3 additions and 3 deletions

View File

@@ -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");

View File

@@ -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");