gridLayer.doCommand(new SelectAllCommand());
// Should find the first cell in grid
final SelectionLayer selectionLayer = gridLayer.getBodyLayer()
.getSelectionLayer();
SelectionSearchStrategy selectionStrategy = new SelectionSearchStrategy(
configRegistry);
selectionStrategy
.setComparator(new CellValueAsStringComparator<Comparable<String>>());
selectionStrategy.setContextLayer(selectionLayer);
PositionCoordinate positionCoordinate = selectionStrategy
.executeSearch(CELL_VALUE);
Assert.assertEquals(0, positionCoordinate.columnPosition);
Assert.assertEquals(0, positionCoordinate.rowPosition);
// Should find last cell
selectionStrategy = new SelectionSearchStrategy(configRegistry,
ISearchDirection.SEARCH_BACKWARDS, true);
selectionStrategy
.setComparator(new CellValueAsStringComparator<Comparable<String>>());
selectionStrategy.setContextLayer(selectionLayer);
positionCoordinate = selectionStrategy.executeSearch(CELL_VALUE);
Assert.assertEquals(9, positionCoordinate.columnPosition);
Assert.assertEquals(4, positionCoordinate.rowPosition);
}