Esempio n. 1
0
  @Test
  public void testDeposits() {
    DollarAmount someAmount = randomDollarAmount();
    batman.deposit(someAmount);
    assertEquals(batman.currentBalance(), batmanInitialBalance.add(someAmount));

    DollarAmount anotherAmount = randomDollarAmount();
    batman.deposit(anotherAmount);
    assertEquals(batman.currentBalance(), batmanInitialBalance.add(someAmount).add(anotherAmount));
  }
Esempio n. 2
0
  @Test
  public void testWithdrawals() {
    DollarAmount someAmount = randomDollarAmount();
    robin.withdrawal(someAmount);
    assertEquals(robin.currentBalance(), robinInitialBalance.subtract(someAmount));

    DollarAmount anotherAmount = randomDollarAmount();
    robin.withdrawal(anotherAmount);
    assertEquals(
        robin.currentBalance(), robinInitialBalance.subtract(someAmount).subtract(anotherAmount));
  }
Esempio n. 3
0
  @Test
  public void testTransfers() {
    DollarAmount someAmount = randomDollarAmount();
    batman.transferTo(robin, someAmount);

    assertEquals(batman.currentBalance(), batmanInitialBalance.subtract(someAmount));
    assertEquals(robin.currentBalance(), robinInitialBalance.add(someAmount));

    DollarAmount anotherAmount = randomDollarAmount();
    robin.transferTo(batman, anotherAmount);
    assertEquals(
        batman.currentBalance(), batmanInitialBalance.subtract(someAmount).add(anotherAmount));
    assertEquals(
        robin.currentBalance(), robinInitialBalance.add(someAmount).subtract(anotherAmount));
  }