This is an automated email from the ASF dual-hosted git repository.
bchapuis pushed a commit to branch raster-processing
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
The following commit(s) were added to refs/heads/raster-processing by this push:
new fc959561 Read wkt
fc959561 is described below
commit fc959561b5a2238448f208aef344cf6d8b0689d9
Author: Bertil Chapuis <[email protected]>
AuthorDate: Sat Aug 3 10:55:51 2024 +0200
Read wkt
---
.../org/apache/baremaps/raster/ContourTracerTest.java | 4 ++--
.../org/apache/baremaps/testing/GeometryAssertions.java | 15 ++++++++++++---
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git
a/baremaps-raster/src/test/java/org/apache/baremaps/raster/ContourTracerTest.java
b/baremaps-raster/src/test/java/org/apache/baremaps/raster/ContourTracerTest.java
index ab28cf3a..0e2167bc 100644
---
a/baremaps-raster/src/test/java/org/apache/baremaps/raster/ContourTracerTest.java
+++
b/baremaps-raster/src/test/java/org/apache/baremaps/raster/ContourTracerTest.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.raster;
+import static
org.apache.baremaps.testing.GeometryAssertions.assertGeometryEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -38,9 +39,8 @@ class ContourTracerTest {
0, 1, 0,
0, 0, 0,
};
- var expectedContour = new WKTReader().read("POLYGON ((1.5 0, 0 1.5, 1.5 3,
3 1.5, 1.5 0))");
var generatedContour = new PolygonContourTracer(grid, 3, 3, true,
true).traceContours(0).get(0);
- assertEquals(expectedContour, generatedContour);
+ assertGeometryEquals("POLYGON ((1.5 0, 0 1.5, 1.5 3, 3 1.5, 1.5 0))",
generatedContour);
}
@Test
diff --git
a/baremaps-testing/src/main/java/org/apache/baremaps/testing/GeometryAssertions.java
b/baremaps-testing/src/main/java/org/apache/baremaps/testing/GeometryAssertions.java
index 627ec105..fa8329b3 100644
---
a/baremaps-testing/src/main/java/org/apache/baremaps/testing/GeometryAssertions.java
+++
b/baremaps-testing/src/main/java/org/apache/baremaps/testing/GeometryAssertions.java
@@ -32,11 +32,20 @@ public class GeometryAssertions {
throw new AssertionError("Expected " + expected + " but was " + actual);
}
- public static void assertGeometryEquals(String wkt, Geometry actual) {
+ public static void assertGeometryEquals(String expected, String actual) {
try {
- assertGeometryEquals(new WKTReader().read(wkt), actual);
+ var reader = new WKTReader();
+ assertGeometryEquals(reader.read(expected), reader.read(expected));
} catch (Exception e) {
- throwAssertionError(wkt, actual);
+ throwAssertionError(expected, actual);
+ }
+ }
+
+ public static void assertGeometryEquals(String expected, Geometry actual) {
+ try {
+ assertGeometryEquals(new WKTReader().read(expected), actual);
+ } catch (Exception e) {
+ throwAssertionError(expected, actual);
}
}