task.searchDocument(executor, null, SearchDirection.UP);
verify(executor);
}
public void testStartingAtLineWorks() {
ViewportModel viewport = createMockViewport(document, 5);
SearchTask task = new SearchTask(document, viewport, scheduler);
LineInfo lineInfo = viewport.getTopLineInfo();
lineInfo.moveToNext();
SearchTaskExecutor executor = EasyMock.createMock(SearchTaskExecutor.class);
expect(executor.onSearchLine(lineInfo.line(), 1, true)).andReturn(true);
expect(
executor.onSearchLine(EasyMock.anyObject(Line.class), EasyMock.anyInt(), EasyMock.eq(true)))
.andReturn(true).times(2);
expect(executor.onSearchLine(viewport.getBottomLine(), 4, true)).andReturn(true);
expect(executor.onSearchLine(
EasyMock.anyObject(Line.class), EasyMock.anyInt(), EasyMock.eq(false)))
.andReturn(true).times(7);
expect(executor.onSearchLine(viewport.getTopLine(), 0, false)).andReturn(true);
replay(executor);
task.searchDocumentStartingAtLine(executor, null, SearchDirection.DOWN, lineInfo);
verify(executor);
}