doNearestPointsTest("POLYGON ((76 185, 125 283, 331 276, 324 122, 177 70, 184 155, 69 123, 76 185), (267 237, 148 248, 135 185, 223 189, 251 151, 286 183, 267 237))", "LINESTRING (120 215, 185 224, 209 207, 238 222, 254 186)", 0.0, new Coordinate(120, 215), new Coordinate(120, 215));
}
private void doNearestPointsTest(String wkt0, String wkt1, double distance,
Coordinate p0, Coordinate p1) throws ParseException {
DistanceOp op = new DistanceOp(new WKTReader().read(wkt0), new WKTReader().read(wkt1));
double tolerance = 1E-10;
assertEquals(distance, op.nearestPoints()[0].distance(op.nearestPoints()[1]), tolerance);
assertEquals(p0.x, op.nearestPoints()[0].x, tolerance);
assertEquals(p0.y, op.nearestPoints()[0].y, tolerance);
assertEquals(p1.x, op.nearestPoints()[1].x, tolerance);
assertEquals(p1.y, op.nearestPoints()[1].y, tolerance);
}