public void testDirectionUpWorks() {
ViewportModel viewport = createMockViewport(document, 5);
SearchTask task = new SearchTask(document, viewport, scheduler);
SearchTaskExecutor executor = EasyMock.createMock(SearchTaskExecutor.class);
expect(executor.onSearchLine(viewport.getBottomLine(), 4, true)).andReturn(true);
expect(
executor.onSearchLine(EasyMock.anyObject(Line.class), EasyMock.anyInt(), EasyMock.eq(true)))
.andReturn(true).times(3);
expect(executor.onSearchLine(viewport.getTopLine(), 0, true)).andReturn(true);
expect(executor.onSearchLine(document.getLastLine(), 11, false)).andReturn(true);
expect(executor.onSearchLine(
EasyMock.anyObject(Line.class), EasyMock.anyInt(), EasyMock.eq(false)))
.andReturn(true).times(6);
replay(executor);
task.searchDocument(executor, null, SearchDirection.UP);