Skip to content

Commit 67cd330

Browse files
feat: test are passing for getBalance and withdraw methods
1 parent faa3c1f commit 67cd330

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

lesson_17/bank/bank_app/src/test/java/com/codedifferently/lesson17/bank/SavingAccountTest.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,30 @@ void deposit_withNegativeAmount() {
4646
.isThrownBy(() -> classUnderTest.deposit(-50.0));
4747
}
4848

49-
// @Test
50-
// void withdraw() {
51-
// classUnderTest.withdraw(50.0);
52-
// assertEquals(50.0, classUnderTest.getBalance());
53-
// }
49+
@Test
50+
void withdraw() {
51+
classUnderTest.withdraw(50.0);
52+
assertEquals(50.0, classUnderTest.getBalance());
53+
}
5454

55-
// @Test
56-
// void withdraw_withNegativeAmount() {
57-
// assertThatExceptionOfType(IllegalStateException.class)
58-
// .isThrownBy(() -> classUnderTest.withdraw(-50.0))
59-
// .withMessage("Withdrawal amount must be positive");
60-
// }
55+
@Test
56+
void withdraw_withNegativeAmount() {
57+
assertThatExceptionOfType(IllegalStateException.class)
58+
.isThrownBy(() -> classUnderTest.withdraw(-50.0))
59+
.withMessage("Withdrawal amount must be positive");
60+
}
6161

62-
// @Test
63-
// void withdraw_withInsufficientBalance() {
64-
// assertThatExceptionOfType(InsufficientFundsException.class)
65-
// .isThrownBy(() -> classUnderTest.withdraw(150.0))
66-
// .withMessage("Account does not have enough funds for withdrawal");
67-
// }
62+
@Test
63+
void withdraw_withInsufficientBalance() {
64+
assertThatExceptionOfType(InsufficientFundsException.class)
65+
.isThrownBy(() -> classUnderTest.withdraw(150.0))
66+
.withMessage("Account does not have enough funds for withdrawal");
67+
}
6868

69-
// @Test
70-
// void getBalance() {
71-
// assertEquals(100.0, classUnderTest.getBalance());
72-
// }
69+
@Test
70+
void getBalance() {
71+
assertEquals(100.0, classUnderTest.getBalance());
72+
}
7373

7474
// @Test
7575
// void closeAccount_withPositiveBalance() {

0 commit comments

Comments
 (0)