Removing duplications from TransactionRepositoryShould
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 4 Dec 2016 17:35:51 +0000 (18:35 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 4 Dec 2016 22:30:21 +0000 (23:30 +0100)
TDD/sandromancuso/bank/src/test/java/org/craftedsw/feature/TransactionRepositoryShould.java

index 0b1e214..7b55677 100644 (file)
@@ -27,11 +27,11 @@ public class TransactionRepositoryShould {
        @Before
        public void initialise() {
                transactionRepository = new TransactionRepository(clock);
+               given(clock.todayAsString()).willReturn(TODAY);
        }
 
        @Test public void
        create_and_store_a_deposit_transaction() {
-               given(clock.todayAsString()).willReturn(TODAY);
                transactionRepository.addDeposit(100);
                
                List<Transaction> transactions = transactionRepository.allTransactions();
@@ -42,7 +42,6 @@ public class TransactionRepositoryShould {
        
        @Test public void
        create_and_store_a_withdrawal_transaction() {
-               given(clock.todayAsString()).willReturn(TODAY);
                transactionRepository.addWithdrawal(100);
                
                List<Transaction> transactions = transactionRepository.allTransactions();