Skip to content

Instantly share code, notes, and snippets.

@meaganewaller
Forked from arlandism/gist:7759985
Created December 2, 2013 22:12
Show Gist options
  • Select an option

  • Save meaganewaller/7760028 to your computer and use it in GitHub Desktop.

Select an option

Save meaganewaller/7760028 to your computer and use it in GitHub Desktop.
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