Permalink
Browse files

Inner loop - Red: Test show account statement

  • Loading branch information...
CarlosMChica committed May 2, 2016
1 parent 27da826 commit 0a0af116beacac964c95552dcef5ae120d2ff817
@@ -5,6 +5,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import java.util.List;
import me.panavtec.androidbankkata.account.BankAccount;
import me.panavtec.androidbankkata.account.statement.StatementView;
@@ -30,4 +31,8 @@ private void initView() {
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
@Override public void show(List<ViewStatementLine> lines) {
throw new UnsupportedOperationException();
}
}
@@ -0,0 +1,9 @@
package me.panavtec.androidbankkata.account.statement;
import java.util.List;
import me.panavtec.androidbankkata.account.transaction.Transaction;
public class Statement {
public Statement(List<Transaction> transactions) {
}
}
@@ -1,4 +1,7 @@
package me.panavtec.androidbankkata.account.statement;
public class StatementFormatter {
public void format(Statement statement) {
throw new UnsupportedOperationException();
}
}
@@ -1,4 +1,8 @@
package me.panavtec.androidbankkata.account.statement;
import java.util.List;
import me.panavtec.androidbankkata.ViewStatementLine;
public interface StatementView {
void show(List<ViewStatementLine> lines);
}
@@ -1,7 +1,13 @@
package me.panavtec.androidbankkata.account.transaction;
import java.util.List;
public class TransactionRepository {
public void store(Transaction transaction) {
throw new UnsupportedOperationException();
}
public List<Transaction> transactions() {
throw new UnsupportedOperationException();
}
}
@@ -1,6 +1,9 @@
package me.panavtec.androidbankkata.account;
import java.util.Date;
import java.util.List;
import me.panavtec.androidbankkata.ViewStatementLine;
import me.panavtec.androidbankkata.account.statement.Statement;
import me.panavtec.androidbankkata.account.statement.StatementFormatter;
import me.panavtec.androidbankkata.account.statement.StatementView;
import me.panavtec.androidbankkata.account.transaction.Deposit;
@@ -12,6 +15,8 @@
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import static java.util.Collections.emptyList;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class) public class BankAccountShouldShould {
@@ -39,6 +44,32 @@
verifyStore(aWithdrawalWith(anAmount()));
}
@Test public void show_statement_containing_transactions() {
BankAccount account = givenAccountWithTransactions();
account.showStatement();
verify(formatter).format(aStatement());
verify(view).show(statementLines());
}
private BankAccount givenAccountWithTransactions() {
given(repository.transactions()).willReturn(transactions());
return givenAccount();
}
private List<ViewStatementLine> statementLines() {
return emptyList();
}
private List<Transaction> transactions() {
return emptyList();
}
private Statement aStatement() {
return new Statement(transactions());
}
private Deposit aDepositWith(int amount) {
return new Deposit(amount, date());
}

0 comments on commit 0a0af11

Please sign in to comment.