Skip to content

Instantly share code, notes, and snippets.

@tarynsauer
Created January 10, 2014 04:07
Show Gist options
  • Save tarynsauer/8346853 to your computer and use it in GitHub Desktop.
Save tarynsauer/8346853 to your computer and use it in GitHub Desktop.
private UI ui;
private MockPrintStream printStream;
@Before
public void setUp() {
MockOutputStream outputStream = new MockOutputStream();
printStream = new MockPrintStream(outputStream);
printStream.setPrintCallHistory(new ArrayList<String>());
ui = new UI(printStream);
}
@Test
public void testGetNextMove() {
MockBufferedReader bufferedReader = new MockBufferedReader(new InputStreamReader(ui.input));
ui.setBufferedReader(bufferedReader);
ArrayList<String> inputArray = new ArrayList<String>();
inputArray.add("1");
bufferedReader.setInputHistory(inputArray);
assertEquals("1", ui.getNextMove());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment