### Question:
RectilinearGridImpl extends AbstractHorizontalGrid implements RectilinearGrid, Serializable { @Override public GridCoordinates2D findIndexOf(HorizontalPosition position) { int x; int y; if (GISUtils.crsMatch(position.getCoordinateReferenceSystem(), crs)) { x = xAxis.findIndexOf(position.getX()); y = yAxis.findIndexOf(position.getY()); } else { HorizontalPosition gridPos = GISUtils.transformPosition(position, crs); x = xAxis.findIndexOf(gridPos.getX()); y = yAxis.findIndexOf(gridPos.getY()); } if (x >= 0 && y >= 0) { return new GridCoordinates2D(x, y); } else { return null; } } protected  RectilinearGridImpl(CoordinateReferenceSystem crs);  RectilinearGridImpl(ReferenceableAxis<Double> xAxis, ReferenceableAxis<Double> yAxis,
            CoordinateReferenceSystem crs); @Override Array2D<GridCell2D> getDomainObjects(); @Override boolean contains(HorizontalPosition position); @Override BoundingBox getBoundingBox(); @Override GeographicBoundingBox getGeographicBoundingBox(); @Override ReferenceableAxis<Double> getXAxis(); @Override ReferenceableAxis<Double> getYAxis(); @Override CoordinateReferenceSystem getCoordinateReferenceSystem(); @Override long size(); @Override GridCoordinates2D findIndexOf(HorizontalPosition position); @Override int getXSize(); @Override int getYSize(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testFindIndexOf() { HorizontalPosition position = new HorizontalPosition(95.3, 34.35, crs); GridCoordinates2D expectedCoord = new GridCoordinates2D(1, 3); assertEquals(expectedCoord, rGrid.findIndexOf(position)); position = new HorizontalPosition(100.4, 40.7, crs); GridCoordinates2D coord = new GridCoordinates2D(11, 15); assertEquals(coord, rGrid.findIndexOf(position)); }