-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutomatedTellerMachineTest.java
More file actions
37 lines (22 loc) · 1.34 KB
/
AutomatedTellerMachineTest.java
File metadata and controls
37 lines (22 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class AutomatedTellerMachineTest {
AutomatedTellerMachine atm = new AutomatedTellerMachine();
private Account[] accounts = {new Account("john", "0123456789", 50.00), new Account("james", "9876543210", 50000.00), new Account("Bolaji", "9786543210", 500.00) };
@BeforeEach
public void setUp() {
atm.setAccounts(accounts);
}
@Test
public void testCanWithdrawFunds() {
atm.withdraw(accounts[1].getAccountNumber(), 20000);
System.out.println(accounts[1]);
assertEquals(30000, accounts[1].getBalance());
}
@Test
public void testWithdrawNegativeAmountThrowsException(){
atm.withdraw(account[1].getAccountNumber(), -30000);
assertThrows();
}
}