@Test
public void testSnapedPoint() throws Exception {

    LineString line = (LineString) wKTReader.read("LINESTRING(0 8, 1 8 , 3 8,  8  8, 10 8, 20 8, 25 8, 30 8, 50 8, 100 8)");
    Point point = (Point) wKTReader.read("POINT(1.5 4 )");
    //Test a point in a segment
    GeometryLocation geomLocation = GeometryEdit.getVertexToSnap(line, point, 4);
    assertEquals(geomLocation.getSegmentIndex(), 1);
    assertTrue(geomLocation.getCoordinate().equals2D(new Coordinate(1.5, 8)));
    //Test a point on an existing coordinate
    point = (Point) wKTReader.read("POINT(1 4 )");
    geomLocation = GeometryEdit.getVertexToSnap(line, point, 4);
    assertEquals(geomLocation.getSegmentIndex(), 0);
    assertTrue(geomLocation.getCoordinate().equals2D(new Coordinate(1, 8)));
    //Test a point on an existing coordinate
    point = (Point) wKTReader.read("POINT(1 4 )");
    geomLocation = GeometryEdit.getVertexToSnap(line, point, 1);
    assertNull(geomLocation);
}