Beispiel #1
0
 @Test
 public void checkAccountActivityWithdrawal() {
   Account a = new Account(Account.CHECKING);
   a.deposit(10);
   a.withdraw(5);
   assertFalse(a.accountInactive());
 }
Beispiel #2
0
  @Test
  public void testTransactions() {
    Account a = new Account(Account.SAVINGS);
    a.deposit(100.5);
    a.withdraw(50.5);
    double balance = a.sumTransactions();

    assertEquals(50.0, balance, DOUBLE_DELTA);
  }
Beispiel #3
0
  @Before
  public void setUp() throws Exception {
    SEK = new Currency("SEK", 0.15);
    SweBank = new Bank("SweBank", SEK);
    SweBank.openAccount("Alice");
    testAccount = new Account("Hans", SEK);
    testAccount.deposit(new Money(10000000, SEK));

    SweBank.deposit("Alice", new Money(1000000, SEK));
  }
Beispiel #4
0
  @Test
  public void testAddWithdraw() {
    // Amount before deposit and withdraw
    int preTransferAmountTestaccount = testAccount.getBalance().getAmount();

    // Try to deposit 200 and check if desired value
    testAccount.deposit(new Money(200, SEK));
    assertEquals(
        preTransferAmountTestaccount + 200, testAccount.getBalance().getAmount().intValue());

    // Try to withdraw 200 and check value
    testAccount.withdraw(new Money(200, SEK));
    assertEquals(preTransferAmountTestaccount, testAccount.getBalance().getAmount().intValue());
  }
Beispiel #5
0
 @Test
 public void checkAccountActivityDeposit() {
   Account a = new Account(Account.CHECKING);
   a.deposit(10);
   assertTrue(a.accountInactive());
 }
Beispiel #6
0
 @Test(expected = IllegalArgumentException.class)
 public void testDepositIllegalArgumentException() {
   Account a = new Account(Account.SAVINGS);
   a.deposit(-2);
 }