PrimitiveFactoryImpl tPrimitiveFactory = (PrimitiveFactoryImpl) builder.getPrimitiveFactory();
DirectPosition dp1 = tCoordFactory.createDirectPosition(new double[] {0, 0});
DirectPosition dp2 = tCoordFactory.createDirectPosition(new double[] {100, 100});
CurveBoundary curveBoundary1 = tPrimitiveFactory.createCurveBoundary(dp1, dp2);
//System.out.println(curveBoundary1);
// RepresentativePoint()
DirectPosition dp = curveBoundary1.getRepresentativePoint();
assertTrue(dp.getOrdinate(0) == 0);
assertTrue(dp.getOrdinate(1) == 0);
assertTrue(curveBoundary1.isCycle() == true);
// Test creating a curve boundary with the same start and end point (should result in
// an exception).
PointImpl point1 = new PointImpl(dp1);
try {
CurveBoundaryImpl b2 = new CurveBoundaryImpl(this.crs, point1, point1);
// fail if we get here, the above should throw an exception
fail();
}
catch (IllegalArgumentException expected) {
}
// test clone
PointImpl point2 = new PointImpl(dp2);
CurveBoundaryImpl b2 = new CurveBoundaryImpl(curveBoundary1.getCoordinateReferenceSystem(), point1, point2);
try {
CurveBoundaryImpl expected = ((CurveBoundaryImpl) curveBoundary1).clone();
assertTrue(b2.equals(expected));
} catch (CloneNotSupportedException e) {
e.printStackTrace();