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

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

    StringBuffer buffer = new StringBuffer();
    batman.printStatement(buffer);
    printBufferWithLines("Full Statement", buffer);
    buffer = new StringBuffer();
    batman.printDeposits(buffer);
    printBufferWithLines("Deposits Only", buffer);
    System.out.println("***************************************");
  }