MainApplicationTest.java 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package com.zipcodewilmington.bankaccountlab;
  2. import org.junit.Before;
  3. import org.junit.Test;
  4. import static org.junit.Assert.*;
  5. public class MainApplicationTest {
  6. MainApplication ma;
  7. @Before
  8. public void setUp() {
  9. ma = new MainApplication();
  10. }
  11. @Test
  12. public void setCurrentAccount() {
  13. Account expected = AccountFactory.getAccount("Business", 10_000);
  14. ma.setCurrentAccount(expected);
  15. Account actual = ma.getCurrentAccount();
  16. assertEquals(expected, actual);
  17. }
  18. @Test
  19. public void askAndReceiveABusinessAccount() {
  20. String accountType = "Business";
  21. int amount = 10_000;
  22. Account expected = ma.createAndSetNewAccount(accountType, amount);
  23. Account actual = ma.getCurrentAccount();
  24. assertEquals(expected, actual);
  25. }
  26. @Test
  27. public void askAndReceiveASavingsAccount() {
  28. String accountType = "Savings";
  29. int amount = 1000;
  30. Account expected = ma.createAndSetNewAccount(accountType, amount);
  31. Account actual = ma.getCurrentAccount();
  32. assertEquals(expected, actual);
  33. }
  34. @Test
  35. public void askAndReceiveACheckingAccount() {
  36. String accountType = "Checking";
  37. int amount = 1000;
  38. Account expected = ma.createAndSetNewAccount(accountType, amount);
  39. Account actual = ma.getCurrentAccount();
  40. assertEquals(expected, actual);
  41. }
  42. }