From: Gustavo Martin Morcuende Date: Sun, 4 Dec 2016 14:59:05 +0000 (+0100) Subject: Writing the asserts and the trigger for those asserts. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=ab2dcf310b54c8ae27fb6e947d0be7afd0228170;p=JavaForFun Writing the asserts and the trigger for those asserts. --- diff --git a/TDD/sandromancuso/bank/src/main/java/org/craftedsw/feature/Console.java b/TDD/sandromancuso/bank/src/main/java/org/craftedsw/feature/Console.java new file mode 100644 index 0000000..64785e5 --- /dev/null +++ b/TDD/sandromancuso/bank/src/main/java/org/craftedsw/feature/Console.java @@ -0,0 +1,9 @@ +package org.craftedsw.feature; + +public class Console { + + public void printLine(String text) { + throw new UnsupportedOperationException(); + } + +} diff --git a/TDD/sandromancuso/bank/src/test/java/org/craftedsw/feature/PrintStatementFeature.java b/TDD/sandromancuso/bank/src/test/java/org/craftedsw/feature/PrintStatementFeature.java index 0af35e2..85ae074 100644 --- a/TDD/sandromancuso/bank/src/test/java/org/craftedsw/feature/PrintStatementFeature.java +++ b/TDD/sandromancuso/bank/src/test/java/org/craftedsw/feature/PrintStatementFeature.java @@ -1,14 +1,21 @@ package org.craftedsw.feature; -import static org.junit.Assert.*; +import static org.mockito.Mockito.verify; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +@RunWith(MockitoJUnitRunner.class) public class PrintStatementFeature { + @Mock private Console console; + @Test public void print_statement_containing_all_transactions() { + account.printStatement(); // console will be some kind of interface that will represent my class console // (always using interfaces for external stuff, like databases, etc, etc)