From a2372c6e49eff2d7959a0977c05ab37b27584287 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Tue, 8 Aug 2023 13:25:49 -0600 Subject: [PATCH] Use JOSM territories annotation Signed-off-by: Taylor Smock --- .../MapWithAISourceReaderTestIT.java | 2 +- .../backend/DownloadListenerTest.java | 2 +- .../backend/DownloadMapWithAITaskTest.java | 2 +- .../backend/GetDataRunnableTest.java | 2 +- .../backend/MapWithAIActionTest.java | 2 +- .../backend/MapWithAIAvailabilityTest.java | 2 +- .../backend/MapWithAIDataUtilsTest.java | 2 +- .../mapwithai/backend/MapWithAILayerTest.java | 2 +- .../backend/MapWithAIMoveActionTest.java | 4 +- .../backend/MapWithAIRemoteControlTest.java | 2 +- .../backend/MapWithAIUploadHookTest.java | 2 +- .../mapwithai/gui/MapWithAIMenuTest.java | 2 +- .../MapWithAIDownloadSourceTypeTest.java | 2 +- .../mapwithai/AddMapWithAIPanelTest.java | 2 +- .../mapwithai/MapWithAISourceReaderTest.java | 2 +- .../annotations/MapWithAISources.java | 1 + .../testutils/annotations/Territories.java | 94 ------------------- .../testutils/annotations/Wiremock.java | 1 + 18 files changed, 18 insertions(+), 110 deletions(-) delete mode 100644 src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Territories.java diff --git a/src/test/integration/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReaderTestIT.java b/src/test/integration/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReaderTestIT.java index 872977f..2056690 100644 --- a/src/test/integration/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReaderTestIT.java +++ b/src/test/integration/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReaderTestIT.java @@ -15,10 +15,10 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo; import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType; import org.openstreetmap.josm.plugins.mapwithai.spi.preferences.MapWithAIConfig; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; /** * Integration test for {@link MapWithAISourceReader} diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadListenerTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadListenerTest.java index be5d471..8de4295 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadListenerTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadListenerTest.java @@ -19,10 +19,10 @@ import org.openstreetmap.josm.gui.MainApplication; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; /** * Test class for {@link DownloadListener} diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadMapWithAITaskTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadMapWithAITaskTest.java index 5d4cdb2..939af6a 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadMapWithAITaskTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/DownloadMapWithAITaskTest.java @@ -18,11 +18,11 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInf import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/GetDataRunnableTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/GetDataRunnableTest.java index c6e8dd2..ffc81d0 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/GetDataRunnableTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/GetDataRunnableTest.java @@ -31,9 +31,9 @@ import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import org.openstreetmap.josm.tools.Geometry; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIActionTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIActionTest.java index 30f09b7..107caa4 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIActionTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIActionTest.java @@ -39,7 +39,7 @@ import org.openstreetmap.josm.tools.Territories; @MapWithAISources @NoExceptions @Projection -@org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories +@org.openstreetmap.josm.testutils.annotations.Territories @Timeout(10) class MapWithAIActionTest { private MapWithAIAction action; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIAvailabilityTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIAvailabilityTest.java index 5e63513..4eae23a 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIAvailabilityTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIAvailabilityTest.java @@ -27,7 +27,7 @@ import org.openstreetmap.josm.tools.Territories; */ @MapWithAISources @Projection -@org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories +@org.openstreetmap.josm.testutils.annotations.Territories @Wiremock class MapWithAIAvailabilityTest { private DataAvailability instance; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIDataUtilsTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIDataUtilsTest.java index b4ff901..3f04f35 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIDataUtilsTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIDataUtilsTest.java @@ -34,12 +34,12 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo; import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Main; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import org.openstreetmap.josm.tools.Logging; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayerTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayerTest.java index f1c2ce6..cfc5327 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayerTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAILayerTest.java @@ -48,7 +48,6 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo; import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock; import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils; import org.openstreetmap.josm.spi.preferences.Config; @@ -56,6 +55,7 @@ import org.openstreetmap.josm.testutils.JOSMTestRules; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Main; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIMoveActionTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIMoveActionTest.java index fe2826c..590c621 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIMoveActionTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIMoveActionTest.java @@ -35,13 +35,13 @@ import org.openstreetmap.josm.plugins.mapwithai.commands.DuplicateCommand; import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock; import org.openstreetmap.josm.plugins.mapwithai.testutils.MissingConnectionTagsMocker; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.LoggingHandler; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.spi.preferences.Config; import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Main; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import org.openstreetmap.josm.testutils.mockers.WindowMocker; import org.openstreetmap.josm.tools.Logging; @@ -52,7 +52,7 @@ import mockit.MockUp; @BasicPreferences @Main @Projection -@org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories(Territories.Initialize.ALL) +@Territories(Territories.Initialize.ALL) @Wiremock class MapWithAIMoveActionTest { private MapWithAIMoveAction moveAction; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIRemoteControlTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIRemoteControlTest.java index 9bf31d8..067a707 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIRemoteControlTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIRemoteControlTest.java @@ -20,11 +20,11 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo; import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Main; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import org.openstreetmap.josm.testutils.annotations.ThreadSync; import org.openstreetmap.josm.tools.Utils; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIUploadHookTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIUploadHookTest.java index b9a064e..ba73a07 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIUploadHookTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIUploadHookTest.java @@ -32,11 +32,11 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo; import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo; import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Main; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; /** * Test class for {@link MapWithAIUploadHook} diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/MapWithAIMenuTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/MapWithAIMenuTest.java index fc3bae9..99105ab 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/MapWithAIMenuTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/MapWithAIMenuTest.java @@ -21,11 +21,11 @@ import org.openstreetmap.josm.gui.MainApplication; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.plugins.mapwithai.actions.AddMapWithAILayerAction; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Main; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import org.openstreetmap.josm.tools.Logging; /** diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/download/MapWithAIDownloadSourceTypeTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/download/MapWithAIDownloadSourceTypeTest.java index 487e905..f2d490f 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/download/MapWithAIDownloadSourceTypeTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/download/MapWithAIDownloadSourceTypeTest.java @@ -13,10 +13,10 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAIDataUtilsTest; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; @BasicPreferences @Projection diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/mapwithai/AddMapWithAIPanelTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/mapwithai/AddMapWithAIPanelTest.java index 6049606..eed6e1e 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/mapwithai/AddMapWithAIPanelTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/gui/preferences/mapwithai/AddMapWithAIPanelTest.java @@ -14,10 +14,10 @@ import org.openstreetmap.josm.gui.widgets.JosmTextArea; import org.openstreetmap.josm.gui.widgets.JosmTextField; import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock; import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import org.openstreetmap.josm.testutils.mockers.WindowMocker; /** diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReaderTest.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReaderTest.java index 1aaf7d2..84a883b 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReaderTest.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/io/mapwithai/MapWithAISourceReaderTest.java @@ -14,9 +14,9 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo; -import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.Projection; +import org.openstreetmap.josm.testutils.annotations.Territories; import com.google.common.collect.ImmutableMap; diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/MapWithAISources.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/MapWithAISources.java index 7523947..d1087ae 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/MapWithAISources.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/MapWithAISources.java @@ -8,6 +8,7 @@ import java.lang.annotation.Target; import org.junit.jupiter.api.extension.ExtendWith; import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo; +import org.openstreetmap.josm.testutils.annotations.Territories; /** * An annotation to use {@link MapWithAILayerInfo} diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Territories.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Territories.java deleted file mode 100644 index 6229715..0000000 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Territories.java +++ /dev/null @@ -1,94 +0,0 @@ -// License: GPL. For details, see LICENSE file. -package org.openstreetmap.josm.plugins.mapwithai.testutils.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.util.Optional; - -import org.junit.jupiter.api.extension.AfterAllCallback; -import org.junit.jupiter.api.extension.BeforeAllCallback; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.platform.commons.support.AnnotationSupport; -import org.openstreetmap.josm.testutils.JOSMTestRules; -import org.openstreetmap.josm.testutils.annotations.BasicPreferences; -import org.openstreetmap.josm.testutils.annotations.Projection; - -/** - * Use boundaries dataset in this test. FIXME: Use the JOSM version - * - * @see JOSMTestRules#territories() - * @author Taylor Smock - * @since xxx - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@BasicPreferences // Needed for nodes -@Projection // Needed for getEastNorth -@ExtendWith(Territories.TerritoriesExtension.class) -public @interface Territories { - /** - * Initialization states. Please note that the highest initialization state - * holds. - * - * @author Taylor Smock - */ - enum Initialize { - /** Don't initialize */ - NONE, - /** Initialize only internal data */ - INTERNAL, - /** Initialize internal and external data */ - ALL - } - - /** - * The way to initialize Territories - * - * @return The value to use - */ - Initialize value() default Initialize.INTERNAL; - - /** - * Initialize boundaries prior to use - * - * @author Taylor Smock - * - */ - class TerritoriesExtension implements BeforeAllCallback, AfterAllCallback { - private static Initialize last = Initialize.NONE; - - @Override - public void afterAll(ExtensionContext context) throws Exception { - synchronized (TerritoriesExtension.class) { - // TODO - // org.openstreetmap.josm.tools.Territories.uninitialize(); - } - } - - @Override - public void beforeAll(ExtensionContext context) throws Exception { - Optional annotation = AnnotationSupport.findAnnotation(context.getElement(), - Territories.class); - if (annotation.isPresent()) { - Initialize current = annotation.get().value(); - if (current.ordinal() <= last.ordinal()) { - return; - } - last = current; - // Avoid potential race conditions if tests are parallelized - synchronized (TerritoriesExtension.class) { - if (current == Initialize.INTERNAL) { - org.openstreetmap.josm.tools.Territories.initializeInternalData(); - } else if (current == Initialize.ALL) { - org.openstreetmap.josm.tools.Territories.initialize(); - } - } - } - } - } -} diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java index 856c26e..9f1bb99 100644 --- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java +++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java @@ -25,6 +25,7 @@ import org.openstreetmap.josm.testutils.annotations.AnnotationUtils; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; import org.openstreetmap.josm.testutils.annotations.BasicWiremock; import org.openstreetmap.josm.testutils.annotations.HTTP; +import org.openstreetmap.josm.testutils.annotations.Territories; import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock;