@Test
public void testInsertVertexInPolygon() throws Exception {

    Polygon polygon = (Polygon) wKTReader.read("POLYGON ((118 134, 118 278, 266 278, 266 134, 118 134 ))");
    Point point = (Point) wKTReader.read("POINT(196 278 )");
    //Test a point in a segment
    Polygon result = GeometryEdit.insertVertexInPolygon(polygon, point, 4);
    assertEquals(result, wKTReader.read("POLYGON ((118 134, 118 278,196 278, 266 278, 266 134, 118 134 ))"));
    //Test a point on an existing coordinate
    point = (Point) wKTReader.read("POINT(196 300 )");
    result = GeometryEdit.insertVertexInPolygon(polygon, point, 4);
    //Because the geometry is not modified
    assertNull(result);
}