BusinessAccountTest.java 802B

12345678910111213141516171819202122232425262728293031323334353637
  1. package com.zipcodewilmington.bankaccountlab;
  2. import org.junit.Before;
  3. import org.junit.Test;
  4. import static org.junit.Assert.*;
  5. public class BusinessAccountTest {
  6. private BusinessAccount ba;
  7. @Before
  8. public void setUp() {
  9. ba = new BusinessAccount(10_000);
  10. }
  11. @Test
  12. public void constructorTest() {
  13. assertTrue(ba.getClass() == BusinessAccount.class);
  14. }
  15. @Test
  16. public void withdrawBalanceTruthyTest() {
  17. assertTrue(ba.withdrawBalance(100));
  18. }
  19. @Test
  20. public void withdrawBalanceFalseyTest() {
  21. assertFalse(ba.withdrawBalance(100_000));
  22. }
  23. @Test
  24. public void depositMoneyTest() {
  25. int expected = 25_000;
  26. int actual = ba.addBalance(15_000).getBalance();
  27. assertEquals(expected, actual);
  28. }
  29. }