assertEquals(5, history.size());
}
@Test
public void testForwardHistorySearch() throws Exception {
MemoryHistory history = setupHistory();
String readLineResult;
reader.setInput(new ByteArrayInputStream(new byte[]{
KeyMap.CTRL_R, 'f', KeyMap.CTRL_R, KeyMap.CTRL_R, KeyMap.CTRL_S, '\n'
}));
readLineResult = reader.readLine();
assertEquals("fiddle", readLineResult);
assertEquals(4, history.size());
reader.setInput(new ByteArrayInputStream(new byte[]{
KeyMap.CTRL_R, 'f', KeyMap.CTRL_R, KeyMap.CTRL_R, KeyMap.CTRL_R, KeyMap.CTRL_S, KeyMap.CTRL_S, '\n'
}));
readLineResult = reader.readLine();
assertEquals("faddle", readLineResult);
assertEquals(5, history.size());
reader.setInput(new ByteArrayInputStream(new byte[]{
KeyMap.CTRL_R, 'f', KeyMap.CTRL_R, KeyMap.CTRL_R, KeyMap.CTRL_R, KeyMap.CTRL_R, KeyMap.CTRL_S, '\n'
}));
readLineResult = reader.readLine();
assertEquals("fiddle", readLineResult);
assertEquals(6, history.size());
}