AtmTest.java 612B

12345678910111213141516171819202122232425262728293031
  1. package com.zipcodewilmington.bankaccountlab;
  2. import org.junit.Assert;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. import static org.junit.Assert.assertEquals;
  6. public class AtmTest {
  7. ATM atm;
  8. @Before
  9. public void setup() {
  10. atm = new ATM();
  11. atm.add(new CheckingAccount(2000));
  12. atm.add(new SavingsAccount(1500));
  13. atm.add(new BusinessAccount(3000));
  14. }
  15. @Test
  16. public void getTotal() {
  17. //Expect
  18. double expected = 6500;
  19. //Actual
  20. double actual = atm.getTotal();
  21. Assert.assertEquals(expected, actual, 0.1);
  22. }
  23. }