package org.craftedsw.feature;
+import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder;
import org.junit.Before;
// Acceptance test is using the real repository because the acceptance test
// is testing the system as a whole. We are just mocking the external world (the Console)
TransactionRepository transactionRepository = new TransactionRepository(clock);
- StatementPrinter statementPrinter = new StatementPrinter();
+ StatementPrinter statementPrinter = new StatementPrinter(console);
account = new Account(transactionRepository, statementPrinter);
}
@Test public void
print_statement_containing_all_transactions() {
+ given(clock.todayAsString()).willReturn("01/04/2014", "02/04/2014", "10/04/2014");
+
account.deposit(1000);
// No negative value, instead we use the verb withdraw.
// Semantics are very important in the code!!!
InOrder inOrder = inOrder(console);
inOrder.verify(console).printLine("DATE | AMOUNT | BALANCE");
- inOrder.verify(console).printLine("10 / 04 / 2014 | 500.00 | 1400.00");
- inOrder.verify(console).printLine("02 / 04 / 2014 | -100.00 | 900.00");
- inOrder.verify(console).printLine("01 / 04 / 2014 | 1000.00 | 1000.00");
+ inOrder.verify(console).printLine("10/04/2014 | 500,00 | 1400,00");
+ inOrder.verify(console).printLine("02/04/2014 | -100,00 | 900,00");
+ inOrder.verify(console).printLine("01/04/2014 | 1000,00 | 1000,00");
}
}