예제 #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));
  }
예제 #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));
  }
예제 #3
0
  @Test
  public void printFullStatement() {
    System.out.println("********** Full Statement ***********");
    DollarAmount someAmount = randomDollarAmount();
    DollarAmount anotherAmount = randomDollarAmount();

    batman.deposit(someAmount);
    batman.deposit(someAmount);
    batman.withdrawal(anotherAmount);

    StringBuffer buffer = new StringBuffer();
    batman.printStatement(buffer);
    printBufferWithLines("Full Statement", buffer);
    System.out.println("***************************************");
  }
예제 #4
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));
  }