//note: doesn't repair all cases; this case isn't:
//ctx.readShapeFromWkt("POLYGON((0 0, 10 0, 10 20))");//doesn't connect around
String wkt = "POLYGON((0 0, 10 0, 10 20, 5 -5, 0 20, 0 0))";//Topology self-intersect
JtsSpatialContextFactory factory = new JtsSpatialContextFactory();
factory.validationRule = JtsWktShapeParser.ValidationRule.repairBuffer0;
JtsSpatialContext ctx = factory.newSpatialContext();
Shape buffer0 = ctx.readShapeFromWkt(wkt);
assertTrue(buffer0.getArea(ctx) > 0);
factory = new JtsSpatialContextFactory();
factory.validationRule = JtsWktShapeParser.ValidationRule.repairConvexHull;
ctx = factory.newSpatialContext();
Shape cvxHull = ctx.readShapeFromWkt(wkt);
assertTrue(cvxHull.getArea(ctx) > 0);
assertEquals(SpatialRelation.CONTAINS, cvxHull.relate(buffer0));
factory = new JtsSpatialContextFactory();
factory.validationRule = JtsWktShapeParser.ValidationRule.none;
ctx = factory.newSpatialContext();
ctx.readShapeFromWkt(wkt);//doesn't throw
}