Created
December 2, 2013 22:09
-
-
Save arlandism/7759985 to your computer and use it in GitHub Desktop.
Mocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyPrinter implements MyPrinterInterface(){ | |
| @Override | |
| public void printToScreen(String toPrint){ | |
| System.out.println(toPrint); | |
| } | |
| } | |
| public class MyPrinterMock implements MyPrinterInterface(){ | |
| private LinkedList<String> history = new LinkedList<String>(); | |
| @Override | |
| public void printToScreen(String toPrint){ | |
| history.push(toPrint); | |
| } | |
| public Boolean lastCallWas(String message){ | |
| return history.peek().equals(message); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment