@Test
public void extendPointTest() throws Exception {
CoordinateReferenceSystem crs;
Coordinate coordinate;
Envelope envelope;
crs = geoService.getCrs("EPSG:900913");
coordinate = new Coordinate(0, 0);
envelope = geocoderUtilService.extendPoint(coordinate, crs, 200, 100);
Assert.assertEquals(-100.00000376900834, envelope.getMinX(), DELTA);
Assert.assertEquals(-50.33697512339748, envelope.getMinY(), DELTA);
Assert.assertEquals(100.00000376900834, envelope.getMaxX(), DELTA);
Assert.assertEquals(50.33697512339748, envelope.getMaxY(), DELTA);
coordinate = new Coordinate(10000, 10000);
envelope = geocoderUtilService.extendPoint(coordinate, crs, 200, 100);
Assert.assertEquals(9899.999874146251, envelope.getMinX(), DELTA);
Assert.assertEquals(9949.6629648107, envelope.getMinY(), DELTA);
Assert.assertEquals(10100.000125853749, envelope.getMaxX(), DELTA);
Assert.assertEquals(10050.3370351893, envelope.getMaxY(), DELTA);
crs = geoService.getCrs("EPSG:4326");
coordinate = new Coordinate(0, 0);
envelope = geocoderUtilService.extendPoint(coordinate, crs, 200, 100);
Assert.assertEquals(-8.983152841199021E-4, envelope.getMinX(), DELTA);
Assert.assertEquals(-4.5218473391466234E-4, envelope.getMinY(), DELTA);
Assert.assertEquals(8.983152841199021E-4, envelope.getMaxX(), DELTA);
Assert.assertEquals(4.5218473391466234E-4, envelope.getMaxY(), DELTA);
coordinate = new Coordinate(100, 50);
envelope = geocoderUtilService.extendPoint(coordinate, crs, 200, 100);
Assert.assertEquals(99.99860521715158, envelope.getMinX(), DELTA);
Assert.assertEquals(49.99955048109636, envelope.getMinY(), DELTA);
Assert.assertEquals(100.00139478284842, envelope.getMaxX(), DELTA);
Assert.assertEquals(50.00044951890364, envelope.getMaxY(), DELTA);
}