From 7279d014ec4b32e792ce41e58a490c841e6c311a Mon Sep 17 00:00:00 2001 From: Giuseppe Villani Date: Wed, 24 May 2023 17:40:08 +0200 Subject: [PATCH] [NOID] fix time assertion GeocodeTest (#3565) --- .../test/java/apoc/spatial/GeocodeTest.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/apoc/spatial/GeocodeTest.java b/core/src/test/java/apoc/spatial/GeocodeTest.java index 715df80432..00551a9c3a 100755 --- a/core/src/test/java/apoc/spatial/GeocodeTest.java +++ b/core/src/test/java/apoc/spatial/GeocodeTest.java @@ -65,10 +65,10 @@ public void initDb() throws Exception { @Test public void testWrongUrlButViaOtherProvider() throws Exception { // wrong url but doesn't fail because provider is osm, not opencage - testGeocodeWithThrottling("osm", false, + testGeocodeWithThrottling("osm", false, map("url", "https://api.opencagedata.com/geocode/v1/json?q=PLACE&key=KEY111")); } - + @Test(expected = QueryExecutionException.class) public void testWrongUrlWithOpenCage() throws Exception { // overwrite ApocConfig provider @@ -108,7 +108,7 @@ public void testGeocodeWithBlockedAddressWithApocConf() { assertGeocodeAllowedUrl(true); }); } - + @Test public void testGeocodeWithBlockedAddressWithConfigMap() { Stream.of("https", "http", "ftp").forEach(protocol -> { @@ -267,9 +267,15 @@ private void testGeocodeAddress(Map map, String provider, AtomicLong time, Map assertFalse(res.hasNext()) ); } else if (map.containsKey("count")) { @@ -339,7 +345,9 @@ private void waitForServerResponseOK(String query, Map params, A return null; }); - time.addAndGet( System.currentTimeMillis() - start ); + if (time != null) { + time.addAndGet(System.currentTimeMillis() - start); + } return true; } catch (Exception e) { String msg = e.getMessage();