@Test
public void testInsertVertexInLineString() throws Exception {

    LineString lineString = (LineString) wKTReader.read("LINESTRING(0 8, 1 8 , 3 8,  8  8, 10 8, 20 8)");
    Point point = (Point) wKTReader.read("POINT(1.5 4 )");
    //Test a point in a segment
    LineString result = GeometryEdit.insertVertexInLineString(lineString, point, 4);
    assertEquals(result, wKTReader.read("LINESTRING(0 8, 1 8 , 1.5 8, 3 8,  8  8, 10 8, 20 8)"));
    //Test a point on an existing coordinate
    point = (Point) wKTReader.read("POINT(1 4 )");
    result = GeometryEdit.insertVertexInLineString(lineString, point, 4);
    //Because the geometry is not modified
    assertNull(result);
}