absurdfarce commented on code in PR #2052:
URL: 
https://github.com/apache/cassandra-java-driver/pull/2052#discussion_r2294651976


##########
core/src/test/java/com/datastax/dse/driver/internal/core/data/geometry/DefaultLineStringTest.java:
##########
@@ -101,8 +104,26 @@ public void should_parse_valid_geo_json() {
   }
 
   @Test
-  public void should_convert_to_geo_json() {
-    assertThat(lineString.asGeoJson()).isEqualTo(json);
+  public void should_convert_to_geo_json() throws Exception {
+
+    ObjectMapper mapper = new ObjectMapper();
+    JsonNode root = mapper.readTree(lineString.asGeoJson());
+    assertThat(root.get("type").toString()).isEqualTo("\"LineString\"");
+
+    double expected[][] = {{30.0, 10.0}, {10.0, 30.0}, {40.0, 40.0}};
+    JsonNode coordinatesNode = root.get("coordinates");
+    assertThat(coordinatesNode.isArray()).isTrue();
+    ArrayNode coordinatesArray = (ArrayNode) coordinatesNode;
+    assertThat(coordinatesArray.size()).isEqualTo(3);
+    for (int i = 0; i < expected.length; ++i) {
+
+      JsonNode elemNode = coordinatesArray.get(i);
+      assertThat(elemNode.isArray()).isTrue();
+      ArrayNode elemArray = (ArrayNode) elemNode;
+      assertThat(elemArray.size()).isEqualTo(2);
+      assertThat(elemArray.get(0).asDouble()).isEqualTo(expected[i][0]);
+      assertThat(elemArray.get(1).asDouble()).isEqualTo(expected[i][1]);
+    }

Review Comment:
   Note: without this change you get failures like the following:
   
   ```
   Per-Commit / Matrix - SERVER_VERSION = 'dse-6.9.0', JABBA_VERSION = 
'[email protected]' / Execute-Tests / 
com.datastax.dse.driver.internal.core.data.geometry.DefaultLineStringTest.should_convert_to_geo_json
   ...
   Error Message
   expected:<...","coordinates":[[30[.0,10.0],[10.0,30.0],[40.0,40.0]]]}"> but 
was:<...","coordinates":[[30[,10],[10,30],[40,40]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}]}">
   Stacktrace
   org.junit.ComparisonFailure: 
expected:<...","coordinates":[[30[.0,10.0],[10.0,30.0],[40.0,40.0]]]}"> but 
was:<...","coordinates":[[30[,10],[10,30],[40,40]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}]}">
        at 
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)
        at 
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at 
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at 
com.datastax.dse.driver.internal.core.data.geometry.DefaultLineStringTest.should_convert_to_geo_json(DefaultLineStringTest.java:105)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:49)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:120)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:95)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:69)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:146)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to