From e3197bb6daaec16d0eb02bee84ca1fcad02ebd5f Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 22 Apr 2020 07:10:35 -0600 Subject: [PATCH] Apply a workaround for JOSM-19132 Signed-off-by: Taylor Smock --- .../josm/plugins/mapwithai/backend/MapWithAILayerTest.java | 2 ++ .../josm/plugins/mapwithai/testutils/MapWithAITestRules.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayerTest.java b/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayerTest.java index 7ec1f34..dd07404 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayerTest.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayerTest.java @@ -47,6 +47,7 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo; import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules; import org.openstreetmap.josm.spi.preferences.Config; import org.openstreetmap.josm.testutils.JOSMTestRules; +import org.openstreetmap.josm.tools.Territories; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -65,6 +66,7 @@ public class MapWithAILayerTest { @Before public void setUp() { layer = new MapWithAILayer(new DataSet(), "test", null); + Territories.initialize(); // Required to avoid an NPE (see JOSM-19132) } @Test diff --git a/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/MapWithAITestRules.java b/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/MapWithAITestRules.java index c48b689..b64a949 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/MapWithAITestRules.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/MapWithAITestRules.java @@ -74,8 +74,8 @@ public class MapWithAITestRules extends JOSMTestRules { private static void setupMapWithAILayerInfo(WireMockServer wireMockServer) { synchronized (MapWithAITestRules.class) { resetMapWithAILayerInfo(); - MapWithAILayerInfo.instance.getLayers().stream() - .forEach(i -> i.setUrl(GetDataRunnableTest.getDefaultMapWithAIAPIForTest(wireMockServer, i.getUrl()))); + MapWithAILayerInfo.instance.getLayers().stream().forEach( + i -> i.setUrl(GetDataRunnableTest.getDefaultMapWithAIAPIForTest(wireMockServer, i.getUrl()))); MapWithAILayerInfo.instance.save(); } }