Ejemplo 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));
  }
Ejemplo 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));
  }
Ejemplo n.º 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("***************************************");
  }
Ejemplo n.º 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));
  }