Refactor test for ST_NumPoints function
@@ -404,13 +404,18 @@ public class TestGeoFunctions
@Test
public void testSTNumPoints()
{
- assertFunction("ST_NumPoints(ST_GeometryFromText('POLYGON ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))", BIGINT, 6L);
- assertFunction("ST_NumPoints(ST_GeometryFromText('MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1)), ((2 4, 2 6, 6 6, 6 4)))'))", BIGINT, 8L);
- assertFunction("ST_NumPoints(ST_GeometryFromText('LINESTRING (8 4, 5 7)'))", BIGINT, 2L);
- assertFunction("ST_NumPoints(ST_GeometryFromText('MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))'))", BIGINT, 4L);
- assertFunction("ST_NumPoints(ST_GeometryFromText('POINT (1 2)'))", BIGINT, 1L);
- assertFunction("ST_NumPoints(ST_GeometryFromText('MULTIPOINT (1 2, 2 4, 3 6, 4 8)'))", BIGINT, 4L);
- assertFunction("ST_NumPoints(ST_GeometryFromText('LINESTRING EMPTY'))", BIGINT, 0L);
+ assertNumPoints("POLYGON ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))", 6);
+ assertNumPoints("MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1)), ((2 4, 2 6, 6 6, 6 4)))", 8);
+ assertNumPoints("LINESTRING (8 4, 5 7)", 2);
+ assertNumPoints("MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))", 4);
+ assertNumPoints("POINT (1 2)", 1);
+ assertNumPoints("MULTIPOINT (1 2, 2 4, 3 6, 4 8)", 4);
+ assertNumPoints("LINESTRING EMPTY", 0);
+ }
+
+ private void assertNumPoints(String wkt, int expectedPoints)
+ {
+ assertFunction(format("ST_NumPoints(ST_GeometryFromText('%s'))", wkt), BIGINT, (long) expectedPoints);
}
@Test
