2727import static org .hamcrest .Matchers .equalTo ;
2828import static org .hamcrest .Matchers .hasKey ;
2929import static org .hamcrest .Matchers .not ;
30+ import static org .junit .jupiter .api .Assertions .assertEquals ;
31+ import static org .junit .jupiter .api .Assertions .assertFalse ;
32+ import static org .junit .jupiter .api .Assertions .assertInstanceOf ;
33+ import static org .junit .jupiter .api .Assertions .assertTrue ;
3034import static org .neo4j .configuration .GraphDatabaseSettings .DEFAULT_DATABASE_NAME ;
3135import static org .neo4j .gis .spatial .Constants .LABEL_LAYER ;
3236import static org .neo4j .gis .spatial .Constants .PROP_GEOMENCODER ;
@@ -136,11 +140,11 @@ public static void testCallFails(GraphDatabaseService db, String call, Map<Strin
136140 public static void testCall (GraphDatabaseService db , String call , Map <String , Object > params ,
137141 Consumer <Map <String , Object >> consumer , boolean onlyOne ) {
138142 testResult (db , call , params , (res ) -> {
139- Assertions . assertTrue (res .hasNext (), "Expect at least one result but got none: " + call );
143+ assertTrue (res .hasNext (), "Expect at least one result but got none: " + call );
140144 Map <String , Object > row = res .next ();
141145 consumer .accept (row );
142146 if (onlyOne ) {
143- Assertions . assertFalse (res .hasNext (), "Expected only one result, but there are more" );
147+ assertFalse (res .hasNext (), "Expected only one result, but there are more" );
144148 }
145149 });
146150 }
@@ -154,7 +158,7 @@ public static void testCallCount(GraphDatabaseService db, String call, Map<Strin
154158 res .next ();
155159 numLeft --;
156160 }
157- Assertions . assertFalse (res .hasNext (), "Expected " + count + " results but there are more" );
161+ assertFalse (res .hasNext (), "Expected " + count + " results but there are more" );
158162 });
159163 }
160164
@@ -355,22 +359,22 @@ public void create_point_geometry_and_distance() {
355359 @ Test
356360 public void create_point_and_return () {
357361 Object geometry = executeObject ("RETURN point({latitude: 5.0, longitude: 4.0}) as geometry" , "geometry" );
358- Assertions . assertTrue ( geometry instanceof Geometry , "Should be Geometry type" );
362+ assertInstanceOf ( Geometry . class , geometry , "Should be Geometry type" );
359363 }
360364
361365 @ Test
362366 public void create_point_geometry_return () {
363367 Object geometry = executeObject (
364368 "WITH point({latitude: 5.0, longitude: 4.0}) as geom RETURN spatial.asGeometry(geom) AS geometry" ,
365369 "geometry" );
366- Assertions . assertTrue ( geometry instanceof Geometry , "Should be Geometry type" );
370+ assertInstanceOf ( Geometry . class , geometry , "Should be Geometry type" );
367371 }
368372
369373 @ Test
370374 public void literal_geometry_return () {
371375 Object geometry = executeObject (
372376 "WITH spatial.asGeometry({latitude: 5.0, longitude: 4.0}) AS geometry RETURN geometry" , "geometry" );
373- Assertions . assertTrue ( geometry instanceof Geometry , "Should be Geometry type" );
377+ assertInstanceOf ( Geometry . class , geometry , "Should be Geometry type" );
374378 }
375379
376380 @ Test
@@ -379,7 +383,7 @@ public void create_node_decode_to_geometry() {
379383 Object geometry = executeObject (
380384 "CREATE (n:Node {geom:'POINT(4.0 5.0)'}) RETURN spatial.decodeGeometry('geom',n) AS geometry" ,
381385 "geometry" );
382- Assertions . assertTrue ( geometry instanceof Geometry , "Should be Geometry type" );
386+ assertInstanceOf ( Geometry . class , geometry , "Should be Geometry type" );
383387 }
384388
385389 @ Test
@@ -781,31 +785,31 @@ public void add_a_node_to_the_spatial_rtree_index_for_simple_points() {
781785 execute ("CALL spatial.addPointLayer('geom')" );
782786 Node node = createNode ("CREATE (n:Node {latitude:60.1,longitude:15.2}) RETURN n" , "n" );
783787 testCall (db , "MATCH (n:Node) WITH n CALL spatial.addNode('geom',n) YIELD node RETURN node" ,
784- r -> Assertions . assertEquals (node , r .get ("node" )));
788+ r -> assertEquals (node , r .get ("node" )));
785789 }
786790
787791 @ Test
788792 public void add_a_node_to_the_spatial_geohash_index_for_simple_points () {
789793 execute ("CALL spatial.addPointLayerGeohash('geom')" );
790794 Node node = createNode ("CREATE (n:Node {latitude:60.1,longitude:15.2}) RETURN n" , "n" );
791795 testCall (db , "MATCH (n:Node) WITH n CALL spatial.addNode('geom',n) YIELD node RETURN node" ,
792- r -> Assertions . assertEquals (node , r .get ("node" )));
796+ r -> assertEquals (node , r .get ("node" )));
793797 }
794798
795799 @ Test
796800 public void add_a_node_to_the_spatial_zorder_index_for_simple_points () {
797801 execute ("CALL spatial.addPointLayerZOrder('geom')" );
798802 Node node = createNode ("CREATE (n:Node {latitude:60.1,longitude:15.2}) RETURN n" , "n" );
799803 testCall (db , "MATCH (n:Node) WITH n CALL spatial.addNode('geom',n) YIELD node RETURN node" ,
800- r -> Assertions . assertEquals (node , r .get ("node" )));
804+ r -> assertEquals (node , r .get ("node" )));
801805 }
802806
803807 @ Test
804808 public void add_a_node_to_the_spatial_hilbert_index_for_simple_points () {
805809 execute ("CALL spatial.addPointLayerHilbert('geom')" );
806810 Node node = createNode ("CREATE (n:Node {latitude:60.1,longitude:15.2}) RETURN n" , "n" );
807811 testCall (db , "MATCH (n:Node) WITH n CALL spatial.addNode('geom',n) YIELD node RETURN node" ,
808- r -> Assertions . assertEquals (node , r .get ("node" )));
812+ r -> assertEquals (node , r .get ("node" )));
809813 }
810814
811815 @ Test
@@ -836,7 +840,7 @@ public void add_a_node_to_multiple_different_indexes_for_both_simple_and_native_
836840 for (String encoder : encoders ) {
837841 for (String indexType : indexes ) {
838842 String layerName = (encoder + indexType ).toLowerCase ();
839- testCall (db , "MATCH (node:Node) RETURN node" , r -> Assertions . assertEquals (node , r .get ("node" )));
843+ testCall (db , "MATCH (node:Node) RETURN node" , r -> assertEquals (node , r .get ("node" )));
840844 testCall (db , "MATCH (n:Node) WITH n CALL spatial.addNode('" + layerName + "',n) YIELD node RETURN node" ,
841845 r -> Assertions .assertEquals (node , r .get ("node" )));
842846 testCall (db , "CALL spatial.withinDistance('" + layerName + "',{lon:15.0,lat:60.0},100)" ,
@@ -908,15 +912,15 @@ public void add_a_node_to_the_spatial_index_short() {
908912 execute ("CALL spatial.addPointLayerXY('geom','lon','lat')" );
909913 Node node = createNode ("CREATE (n:Node {lat:60.1,lon:15.2}) RETURN n" , "n" );
910914 testCall (db , "MATCH (n:Node) WITH n CALL spatial.addNode('geom',n) YIELD node RETURN node" ,
911- r -> Assertions . assertEquals (node , r .get ("node" )));
915+ r -> assertEquals (node , r .get ("node" )));
912916 }
913917
914918 @ Test
915919 public void add_a_node_to_the_spatial_index_short_with_geohash () {
916920 execute ("CALL spatial.addPointLayerXY('geom','lon','lat','geohash')" );
917921 Node node = createNode ("CREATE (n:Node {lat:60.1,lon:15.2}) RETURN n" , "n" );
918922 testCall (db , "MATCH (n:Node) WITH n CALL spatial.addNode('geom',n) YIELD node RETURN node" ,
919- r -> Assertions . assertEquals (node , r .get ("node" )));
923+ r -> assertEquals (node , r .get ("node" )));
920924 }
921925
922926 @ Test
@@ -931,7 +935,7 @@ public void add_two_nodes_to_the_spatial_layer() {
931935 node1 = ((Node ) row .get ("n1" )).getElementId ();
932936 node2 = ((Node ) row .get ("n2" )).getElementId ();
933937 long count = (Long ) row .get ("count" );
934- Assertions . assertEquals (2L , count );
938+ assertEquals (2L , count );
935939 result .close ();
936940 tx .commit ();
937941 }
@@ -947,7 +951,7 @@ public void add_two_nodes_to_the_spatial_layer() {
947951 map ("nodeId" , node1 )).next ().get ("node" );
948952 Result removeResult = tx .execute ("CALL spatial.removeNode('geom',$node) YIELD nodeId RETURN nodeId" ,
949953 map ("node" , node ));
950- Assertions . assertEquals (node1 , removeResult .next ().get ("nodeId" ));
954+ assertEquals (node1 , removeResult .next ().get ("nodeId" ));
951955 removeResult .close ();
952956 tx .commit ();
953957 }
@@ -959,7 +963,7 @@ public void add_two_nodes_to_the_spatial_layer() {
959963 try (Transaction tx = db .beginTx ()) {
960964 Result removeResult = tx .execute ("CALL spatial.removeNode.byId('geom',$nodeId) YIELD nodeId RETURN nodeId" ,
961965 map ("nodeId" , node2 ));
962- Assertions . assertEquals (node2 , removeResult .next ().get ("nodeId" ));
966+ assertEquals (node2 , removeResult .next ().get ("nodeId" ));
963967 removeResult .close ();
964968 tx .commit ();
965969 }
@@ -1227,10 +1231,10 @@ private void testCountQuery(String name, String query, long count, String column
12271231 }
12281232 long start = System .currentTimeMillis ();
12291233 testResult (db , query , params , res -> {
1230- Assertions .assertTrue (res .hasNext (), "Expected a single result" );
1234+ Assertions .assertTrue (res .hasNext (), "Expected a single result" );
12311235 long c = (Long ) res .next ().get (column );
1232- Assertions . assertFalse (res .hasNext (), "Expected a single result" );
1233- Assertions . assertEquals (count , c , "Expected count of " + count + " nodes but got " + c );
1236+ assertFalse (res .hasNext (), "Expected a single result" );
1237+ assertEquals (count , c , "Expected count of " + count + " nodes but got " + c );
12341238 }
12351239 );
12361240 System .out .println (name + " query took " + (System .currentTimeMillis () - start ) + "ms - " + params );
0 commit comments