Index: /trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java	(revision 18869)
+++ /trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java	(revision 18870)
@@ -356,5 +356,7 @@
         ProjectionRegistry.setProjection(Projections.getProjectionByCode("epsg:3857".toUpperCase(Locale.ROOT)));
 
-        Territories.initializeInternalData();
+        if (Territories.getKnownIso3166Codes().isEmpty()) {
+            Territories.initializeInternalData();
+        }
         OsmValidator.initialize();
         MapPaintStyles.readFromPreferences();
Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java	(revision 18869)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java	(revision 18870)
@@ -458,5 +458,5 @@
                     List<Way> prims = Arrays.asList(es1.getWay(), es2.getWay());
                     if ((highlight = crossingWays.get(prims)) == null) {
-                        highlight = new ArrayList<>();
+                        highlight = new ArrayList<>(2);
                         highlight.add(es1);
                         highlight.add(es2);
Index: /trunk/test/functional/org/openstreetmap/josm/data/BoundariesTestIT.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/data/BoundariesTestIT.java	(revision 18869)
+++ /trunk/test/functional/org/openstreetmap/josm/data/BoundariesTestIT.java	(revision 18870)
@@ -12,16 +12,14 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.search.SearchCompiler;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 
 /**
  * Test of boundaries OSM file.
  */
+@BasicPreferences
 class BoundariesTestIT {
 
@@ -46,11 +44,4 @@
             "US-PR", "US-RI", "US-SC", "US-SD", "US-TN", "US-TX", "US-UM", "US-UT", "US-VT", "US-VA", "US-VI", "US-WA", "US-WV", "US-WI",
             "US-WY");
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences();
 
     /**
Index: /trunk/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java	(revision 18869)
+++ /trunk/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java	(revision 18870)
@@ -7,10 +7,8 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.tools.HttpClient;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
@@ -18,15 +16,10 @@
  * See <a href="https://josm.openstreetmap.de/wiki/ImageryCompare">JOSM wiki</a>
  */
+@BasicPreferences
+@Timeout(60)
 class ImageryCompareTestIT {
 
     private static final String BLACK_PREFIX = "<pre style=\"margin:3px;color:black\">";
     private static final String RED_PREFIX = "<pre style=\"margin:3px;color:red\">";
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(60000);
 
     /**
Index: /trunk/test/functional/org/openstreetmap/josm/data/osm/TaginfoTestIT.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/data/osm/TaginfoTestIT.java	(revision 18869)
+++ /trunk/test/functional/org/openstreetmap/josm/data/osm/TaginfoTestIT.java	(revision 18870)
@@ -10,4 +10,14 @@
 import java.util.List;
 
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
+import org.openstreetmap.josm.data.validation.tests.TagChecker;
+import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
+import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.tools.HttpClient;
+
 import jakarta.json.Json;
 import jakarta.json.JsonObject;
@@ -15,37 +25,17 @@
 import jakarta.json.JsonValue;
 
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
-import org.openstreetmap.josm.data.validation.tests.TagChecker;
-import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
-import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-import org.openstreetmap.josm.tools.HttpClient;
-import org.xml.sax.SAXException;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
 /**
  * Various integration tests with Taginfo.
  */
+@BasicPreferences
+@Timeout(20)
 class TaginfoTestIT {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000);
-
     /**
      * Checks that popular tags are known (i.e included in internal presets, or deprecated, or explicitely ignored)
-     * @throws SAXException if any XML parsing error occurs
      * @throws IOException if any I/O error occurs
      * @throws ParseException if any MapCSS parsing error occurs
      */
     @Test
-    void testCheckPopularTags() throws SAXException, IOException, ParseException {
+    void testCheckPopularTags() throws IOException, ParseException {
         TaggingPresets.readFromPreferences();
         new TagChecker().initialize();
Index: /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java	(revision 18869)
+++ /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java	(revision 18870)
@@ -28,5 +28,4 @@
 import javax.imageio.ImageIO;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
@@ -40,9 +39,8 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.ColorHelper;
 import org.openstreetmap.josm.tools.Utils;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
@@ -52,4 +50,6 @@
  * @author Michael Zangl
  */
+@BasicPreferences
+@Projection
 public class MapCSSRendererTest {
     private static final String TEST_DATA_BASE = "/renderer/";
@@ -59,11 +59,4 @@
     private static final Bounds AREA_DEFAULT = new Bounds(0, 0, 1, 1);
     private static final int IMAGE_SIZE = 256;
-
-    /**
-     * Minimal test rules required
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
 
     // development flag - set to true in order to update all reference images
Index: /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java	(revision 18869)
+++ /trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java	(revision 18870)
@@ -10,11 +10,13 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.IdentityHashMap;
 
 import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -27,13 +29,19 @@
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.io.Compression;
+import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-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.tools.Pair;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Test {@link StyleCache}.
  */
+@BasicPreferences
+@Main
+@org.openstreetmap.josm.testutils.annotations.MapPaintStyles
+@Projection
+@Timeout(60)
 class StyleCacheTest {
 
@@ -47,10 +55,11 @@
     private static DataSet dsCity2;
 
-    /**
-     * The test rules used for this test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().mapStyles().timeout(60000);
+    @BeforeAll
+    static void beforeAll() throws IllegalDataException, IOException {
+        try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) {
+            dsCity = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
+        }
+        dsCity2 = new DataSet(dsCity);
+    }
 
     /**
@@ -61,8 +70,4 @@
     public void load() throws Exception {
         img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
-        try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) {
-            dsCity = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
-        }
-        dsCity2 = new DataSet(dsCity);
     }
 
@@ -97,9 +102,9 @@
      * Verifies, that the intern pool is not growing when repeatedly rendering the
      * same set of primitives (and clearing the calculated styles each time).
-     *
+     * <p>
      * If it grows, this is an indication that the {@code equals} and {@code hashCode}
      * implementation is broken and two identical objects are not recognized as equal
      * or produce different hash codes.
-     *
+     * <p>
      * The opposite problem (different objects are mistaken as equal) has more visible
      * consequences for the user (wrong rendering on the map) and is not recognized by
@@ -135,5 +140,5 @@
      * Verifies, that the number of {@code StyleElementList} instances stored
      * for all the rendered primitives is actually low (as intended).
-     *
+     * <p>
      * Two primitives with the same style should share one {@code StyleElementList}
      * instance for the cached style elements. This is verified by counting all
Index: /trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java
===================================================================
--- /trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java	(revision 18869)
+++ /trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java	(revision 18870)
@@ -17,9 +17,8 @@
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.PerformanceTestUtils;
 import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
 import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -29,4 +28,5 @@
  * @author Michael Zangl
  */
+@Projection
 @Timeout(value = 15, unit = TimeUnit.MINUTES)
 class KeyValuePerformanceTest {
@@ -40,11 +40,4 @@
 
     /**
-     * Prepare the test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
-    /**
      * See if there is a big difference between Strings that are interned and those that are not.
      */
Index: /trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java
===================================================================
--- /trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java	(revision 18869)
+++ /trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java	(revision 18870)
@@ -17,5 +17,4 @@
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.PerformanceTestUtils;
 import org.openstreetmap.josm.data.Bounds;
@@ -25,4 +24,6 @@
 import org.openstreetmap.josm.io.Compression;
 import org.openstreetmap.josm.io.OsmReader;
+import org.openstreetmap.josm.testutils.annotations.Projection;
+import org.openstreetmap.josm.testutils.annotations.Territories;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -31,4 +32,6 @@
  * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}.
  */
+@Projection
+@Territories
 @Timeout(value = 15, unit = TimeUnit.MINUTES)
 abstract class AbstractMapRendererPerformanceTestParent {
@@ -49,5 +52,4 @@
 
     protected static void load() throws Exception {
-        JOSMFixture.createPerformanceTestFixture().init(true);
         img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
         g = (Graphics2D) img.getGraphics();
Index: /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java
===================================================================
--- /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java	(revision 18869)
+++ /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java	(revision 18870)
@@ -19,4 +19,5 @@
 import java.util.Locale;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
@@ -26,6 +27,5 @@
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.openstreetmap.josm.JOSMFixture;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.PerformanceTestUtils;
 import org.openstreetmap.josm.TestUtils;
@@ -44,5 +44,8 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
-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;
@@ -51,4 +54,9 @@
  * Performance test of map renderer.
  */
+@BasicPreferences
+@Main
+@Projection
+@Territories
+@Timeout(value = 15, unit = TimeUnit.MINUTES)
 public class MapRendererPerformanceTest {
 
@@ -82,11 +90,4 @@
 
     /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().preferences().timeout(15 * 60 * 1000);
-
-    /**
      * Initializes test environment.
      * @throws Exception if any error occurs
@@ -94,6 +95,4 @@
     @BeforeAll
     public static void load() throws Exception {
-        JOSMFixture.createPerformanceTestFixture().init(true);
-
         img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
         g = (Graphics2D) img.getGraphics();
Index: /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java
===================================================================
--- /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java	(revision 18869)
+++ /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java	(revision 18870)
@@ -11,6 +11,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.BeforeAll;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.PerformanceTestUtils;
 import org.openstreetmap.josm.data.Bounds;
@@ -22,4 +20,5 @@
 import org.openstreetmap.josm.gui.mappaint.MapRendererPerformanceTest;
 import org.openstreetmap.josm.io.IllegalDataException;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
@@ -28,4 +27,5 @@
  *
  */
+@Projection
 class MapCSSPerformanceTest {
 
@@ -46,12 +46,4 @@
                       "Please update configuration settings in the unit test file.");
           }
-    }
-
-    /**
-     * Setup test.
-     */
-    @BeforeAll
-    public static void createJOSMFixture() {
-        JOSMFixture.createPerformanceTestFixture().init(true);
     }
 
Index: /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java
===================================================================
--- /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java	(revision 18869)
+++ /trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java	(revision 18870)
@@ -4,8 +4,6 @@
 import java.util.concurrent.TimeUnit;
 
-import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.PerformanceTestUtils;
 import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
@@ -13,4 +11,5 @@
 import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator;
 import org.openstreetmap.josm.gui.mappaint.MultiCascade;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
@@ -18,4 +17,5 @@
  * @author Michael Zangl
  */
+@Projection
 @Timeout(value = 15, unit = TimeUnit.MINUTES)
 class MapCSSStyleSourceFilterTest {
@@ -82,12 +82,4 @@
 
     /**
-     * Prepare the test.
-     */
-    @BeforeAll
-    public static void createJOSMFixture() {
-        JOSMFixture.createPerformanceTestFixture().init(true);
-    }
-
-    /**
      * Time how long it takes to evaluate [key=value] rules
      */
Index: /trunk/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java	(revision 18870)
@@ -2,24 +2,15 @@
 package org.openstreetmap.josm.actions;
 
-import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link AboutAction}.
  */
+@Main
 final class AboutActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Unit test of {@link AboutAction#buildAboutPanel}.
@@ -27,5 +18,5 @@
     @Test
     void testBuildAboutPanel() {
-        assertNotNull(new AboutAction().buildAboutPanel());
+        assertDoesNotThrow(() -> new AboutAction().buildAboutPanel());
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java	(revision 18870)
@@ -11,5 +11,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.gui.jmapviewer.FeatureAdapter;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
@@ -17,25 +16,19 @@
 import org.openstreetmap.josm.gui.layer.TMSLayer;
 import org.openstreetmap.josm.gui.layer.WMSLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 import com.github.tomakehurst.wiremock.WireMockServer;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link AddImageryLayerAction}.
  */
+@BasicPreferences
 @BasicWiremock
-@BasicPreferences
+@OsmApi(OsmApi.APIType.FAKE)
+@Projection
 final class AddImageryLayerActionTest {
-    /**
-     * We need prefs for this. We need platform for actions and the OSM API for checking blacklist.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().fakeAPI().projection();
-
     /**
      * HTTP mock.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java	(revision 18870)
@@ -18,5 +18,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.actions.AlignInCircleAction.InvalidSelection;
@@ -30,22 +29,12 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.opentest4j.AssertionFailedError;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link AlignInLineAction}.
  */
+@Projection
 final class AlignInCircleActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
-
     /**
      * Test case: way with several nodes selected
@@ -65,17 +54,15 @@
         }
         assertNotNull(roundabout);
-        if (roundabout != null) {
-            ds.setSelected(roundabout);
-            Command c = AlignInCircleAction.buildCommand(ds);
-            c.executeCommand();
-            Way expected = (Way) ds2.getPrimitiveById(roundabout);
-            assertNotNull(expected);
-            assertEquals(expected, roundabout);
-            assertEquals(expected.getNodesCount(), roundabout.getNodesCount());
-            for (Node n1 : roundabout.getNodes()) {
-                Node n2 = (Node) ds2.getPrimitiveById(n1);
-                assertEquals(n1.lat(), n2.lat(), 1e-5);
-                assertEquals(n1.lon(), n2.lon(), 1e-5);
-            }
+        ds.setSelected(roundabout);
+        Command c = AlignInCircleAction.buildCommand(ds);
+        c.executeCommand();
+        Way expected = (Way) ds2.getPrimitiveById(roundabout);
+        assertNotNull(expected);
+        assertEquals(expected, roundabout);
+        assertEquals(expected.getNodesCount(), roundabout.getNodesCount());
+        for (Node n1 : roundabout.getNodes()) {
+            Node n2 = (Node) ds2.getPrimitiveById(n1);
+            assertEquals(n1.lat(), n2.lat(), 1e-5);
+            assertEquals(n1.lon(), n2.lon(), 1e-5);
         }
     }
@@ -98,8 +85,6 @@
         }
         assertNotNull(roundabout);
-        if (roundabout != null) {
-            ds.setSelected(roundabout);
-            assertNull(AlignInCircleAction.buildCommand(ds));
-        }
+        ds.setSelected(roundabout);
+        assertNull(AlignInCircleAction.buildCommand(ds));
     }
 
@@ -121,18 +106,16 @@
         }
         assertNotNull(circularWay);
-        if (circularWay != null) {
-            ds.setSelected(circularWay.getNodes());
-            Command c = AlignInCircleAction.buildCommand(ds);
-            assertNotNull(c);
-            c.executeCommand();
-            Way expected = (Way) ds2.getPrimitiveById(circularWay);
-            assertNotNull(expected);
-            assertEquals(expected, circularWay);
-            assertEquals(expected.getNodesCount(), circularWay.getNodesCount());
-            for (Node n1 : circularWay.getNodes()) {
-                Node n2 = (Node) ds2.getPrimitiveById(n1);
-                assertEquals(n1.lat(), n2.lat(), 1e-5);
-                assertEquals(n1.lon(), n2.lon(), 1e-5);
-            }
+        ds.setSelected(circularWay.getNodes());
+        Command c = AlignInCircleAction.buildCommand(ds);
+        assertNotNull(c);
+        c.executeCommand();
+        Way expected = (Way) ds2.getPrimitiveById(circularWay);
+        assertNotNull(expected);
+        assertEquals(expected, circularWay);
+        assertEquals(expected.getNodesCount(), circularWay.getNodesCount());
+        for (Node n1 : circularWay.getNodes()) {
+            Node n2 = (Node) ds2.getPrimitiveById(n1);
+            assertEquals(n1.lat(), n2.lat(), 1e-5);
+            assertEquals(n1.lon(), n2.lon(), 1e-5);
         }
     }
Index: /trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java	(revision 18870)
@@ -2,6 +2,6 @@
 package org.openstreetmap.josm.actions;
 
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -9,5 +9,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.actions.AlignInLineAction.InvalidSelection;
 import org.openstreetmap.josm.actions.AlignInLineAction.Line;
@@ -18,20 +17,13 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.MainApplication;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link AlignInLineAction}.
  */
+@Main
+@Projection
 final class AlignInLineActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /** Class under test. */
     private static AlignInLineAction action;
@@ -50,6 +42,6 @@
      * Test case: only nodes selected, part of an open way: align these nodes on the line passing through the extremity
      * nodes (the most distant in the way sequence, not the most euclidean-distant). See
-     * https://josm.openstreetmap.de/ticket/9605#comment:3. Note that in this test, after alignment, way is overlapping
-     * itself.
+     * <a href="https://josm.openstreetmap.de/ticket/9605#comment:3">comment:3:ticket:9605</a>.
+     * Note that in this test, after alignment, way is overlapping itself.
      * @throws InvalidSelection never
      */
@@ -211,9 +203,9 @@
     @Test
     void testLineDifferentCoordinates() throws InvalidSelection {
-        assertNotNull(new Line(new Node(new EastNorth(0, 1)),
+        assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)),
                                new Node(new EastNorth(0, 2))));
-        assertNotNull(new Line(new Node(new EastNorth(0, 1)),
+        assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)),
                                new Node(new EastNorth(1, 1))));
-        assertNotNull(new Line(new Node(new EastNorth(0, 1)),
+        assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)),
                                new Node(new EastNorth(0+1e-150, 1+1e-150))));
     }
Index: /trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java	(revision 18870)
@@ -23,4 +23,5 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
+import org.openstreetmap.josm.testutils.annotations.ResetUniquePrimitiveIdCounters;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
@@ -114,4 +115,5 @@
      */
     @Test
+    @ResetUniquePrimitiveIdCounters
     void testTicket18367NeedsSplit() throws IOException, IllegalDataException {
         try (InputStream is = TestUtils.getRegressionDataStream(18367, "split-and-reverse.osm")) {
Index: /trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java	(revision 18870)
@@ -17,5 +17,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -26,11 +25,16 @@
 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link CopyAction}.
  */
+@BasicPreferences
+@Main
+@OsmApi(OsmApi.APIType.FAKE)
+@Projection
 class CopyActionTest {
     private static final class CapturingCopyAction extends CopyAction {
@@ -42,11 +46,4 @@
         }
     }
-
-    /**
-     * We need prefs for this.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public static JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI().main().projection();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java	(revision 18870)
@@ -10,5 +10,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -17,5 +16,5 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.GeoProperty;
 import org.openstreetmap.josm.tools.GeoPropertyIndex;
@@ -24,26 +23,16 @@
 import org.openstreetmap.josm.tools.RightAndLefthandTraffic;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
 /**
  * Unit tests for class {@link CreateCircleAction}.
  */
+@Projection
 final class CreateCircleActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     /**
      * Test case: When Create Circle action is performed with a single way selected,
      * circle direction must equals way direction.
      * see #7421
-     * @throws ReflectiveOperationException if an error occurs
      */
     @Test
-    void testTicket7421case0() throws ReflectiveOperationException {
+    void testTicket7421case0() {
         DataSet dataSet = new DataSet();
 
Index: /trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java	(revision 18870)
@@ -15,5 +15,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.command.SequenceCommand;
@@ -30,22 +29,19 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.io.OsmReader;
-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.MapPaintStyles;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.Pair;
 import org.openstreetmap.josm.tools.SubclassFilteredCollection;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit test of {@link CreateMultipolygonAction}
  */
+@BasicPreferences
+@Main
+@MapPaintStyles
+@Projection
 class CreateMultipolygonActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().main().preferences().mapStyles();
-
     private static Map<String, String> getRefToRoleMap(Relation relation) {
         Map<String, String> refToRole = new TreeMap<>();
Index: /trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java	(revision 18870)
@@ -9,5 +9,4 @@
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.cache.JCSCacheManager;
@@ -15,11 +14,9 @@
 import org.openstreetmap.josm.gui.io.SaveLayersDialog;
 import org.openstreetmap.josm.gui.progress.swing.ProgressMonitorExecutor;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Utils;
 
 import com.ginsberg.junit.exit.ExpectSystemExitWithStatus;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import mockit.Invocation;
 import mockit.Mock;
@@ -29,13 +26,6 @@
  * Unit tests for class {@link ExitAction}.
  */
+@Main
 final class ExitActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     @BeforeAll
     static void beforeAll() {
Index: /trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java	(revision 18870)
@@ -2,21 +2,12 @@
 package org.openstreetmap.josm.actions;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Test {@link FullscreenToggleAction}
  */
+@Main
 class FullscreenToggleActionTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Test {@link FullscreenToggleAction}
Index: /trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java	(revision 18870)
@@ -17,5 +17,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.actions.search.SearchAction;
@@ -36,22 +35,17 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-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.tools.MultiMap;
 import org.openstreetmap.josm.tools.Utils;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link JoinAreasAction} class.
  */
+@BasicPreferences
+@Main
+@Projection
 class JoinAreasActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
-
     /**
      * Non-regression test for bug #9599.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java	(revision 18870)
@@ -13,5 +13,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -27,20 +26,16 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.io.OsmReader;
-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.tools.Geometry;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link JoinNodeWayAction}.
  */
+@BasicPreferences
+@Main
+@Projection
 final class JoinNodeWayActionTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().main().preferences();
-
     private void setupMapView(DataSet ds) {
         // setup a reasonable size for the edit window
@@ -60,8 +55,7 @@
      * Test case: Move node onto two almost overlapping ways
      * see #18189 moveontoway.osm
-     * @throws Exception if an error occurs
-     */
-    @Test
-    void testTicket18189() throws Exception {
+     */
+    @Test
+    void testTicket18189() {
         DataSet dataSet = new DataSet();
         OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
Index: /trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java	(revision 18870)
@@ -12,5 +12,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -20,22 +19,15 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.widgets.JosmComboBox;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link MergeLayerAction}.
  */
+@Main
+@Projection
 public class MergeLayerActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * MergeLayerExtendedDialog mocker.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java	(revision 18870)
@@ -8,27 +8,18 @@
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.List;
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link MergeNodesAction}.
  */
+@Projection
 class MergeNodesActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     /**
      * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - empty list
@@ -36,5 +27,6 @@
     @Test
     void testSelectTargetLocationNodeEmpty() {
-        assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(Collections.emptyList()));
+        final List<Node> noNodes = Collections.emptyList();
+        assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(noNodes));
     }
 
@@ -45,5 +37,6 @@
     void testSelectTargetLocationNodeInvalidMode() {
         Config.getPref().putInt("merge-nodes.mode", -1);
-        assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))));
+        final List<Node> nodes = Arrays.asList(new Node(0), new Node(1));
+        assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(nodes));
     }
 
@@ -62,5 +55,5 @@
         Config.getPref().putInt("merge-nodes.mode", 2);
         assertEquals(LatLon.NORTH_POLE, MergeNodesAction.selectTargetLocationNode(
-                Arrays.asList(new Node(LatLon.NORTH_POLE))).getCoor());
+                Collections.singletonList(new Node(LatLon.NORTH_POLE))).getCoor());
     }
 
@@ -74,5 +67,5 @@
         Node n1 = new Node(1);
         ds.addPrimitive(n1);
-        assertEquals(1, MergeNodesAction.selectTargetNode(Arrays.asList(n1)).getId());
+        assertEquals(1, MergeNodesAction.selectTargetNode(Collections.singletonList(n1)).getId());
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java	(revision 18870)
@@ -12,5 +12,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.actions.OrthogonalizeAction.Direction;
@@ -23,9 +22,8 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.Geometry;
 import org.openstreetmap.josm.tools.SubclassFilteredCollection;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import net.trajano.commons.testing.UtilityClassTestUtil;
 
@@ -33,15 +31,8 @@
  * Unit tests for class {@link OrthogonalizeAction}.
  */
+@Projection
 class OrthogonalizeActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     @Test
-    void testNoSelection() throws Exception {
+    void testNoSelection() {
         assertThrows(OrthogonalizeAction.InvalidUserInputException.class, () -> performTest("nothing selected"));
     }
Index: /trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java	(revision 18870)
@@ -5,9 +5,7 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -18,28 +16,20 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link PurgeAction}.
  */
+@Main
+@Projection
 class PurgeActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public static JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Non-regression test for ticket #12038.
      * @throws IOException if any I/O error occurs
-     * @throws FileNotFoundException if the data file cannot be found
      * @throws IllegalDataException if OSM parsing fails
      */
     @Test
-    void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException {
+    void testCopyStringWayRelation() throws IOException, IllegalDataException {
         try (InputStream is = TestUtils.getRegressionDataStream(12038, "data.osm")) {
             DataSet ds = OsmReader.parseDataSet(is, null);
Index: /trunk/test/unit/org/openstreetmap/josm/actions/RestorePropertyActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/RestorePropertyActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/RestorePropertyActionTest.java	(revision 18870)
@@ -8,5 +8,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.command.ChangePropertyCommand;
 import org.openstreetmap.josm.data.UndoRedoHandler;
@@ -14,20 +13,11 @@
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 
 /**
  * Unit tests of {@link RestorePropertyAction}
  */
+@BasicPreferences
 class RestorePropertyActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences();
-
     @Test
     void testTicket20965() {
Index: /trunk/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java	(revision 18870)
@@ -4,24 +4,18 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.gui.MainApplication;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link SelectAllAction}.
  */
+@BasicPreferences
+@Main
+@Projection
 final class SelectAllActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main();
-
     /**
      * Unit test of {@link SelectAllAction#actionPerformed} method.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java	(revision 18870)
@@ -7,5 +7,4 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -18,7 +17,8 @@
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-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 edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import net.trajano.commons.testing.UtilityClassTestUtil;
 
@@ -26,13 +26,8 @@
  * Unit tests for class {@link SelectByInternalPointAction}.
  */
+@BasicPreferences
+@Main
+@Projection
 final class SelectByInternalPointActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main();
-
     /**
      * Tests that {@code SelectByInternalPointAction} satisfies utility class criteria.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java	(revision 18870)
@@ -5,21 +5,11 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Unit tests for class {@link SessionSaveAsAction}.
  */
+@Main
 class SessionSaveAsActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Unit test of {@link SessionSaveAsAction#actionPerformed}
Index: /trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java	(revision 18870)
@@ -18,5 +18,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.command.DeleteCommand;
@@ -29,23 +28,17 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.Utils;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for class {@link SimplifyWayAction}.
  */
+@Main
+@Projection
 final class SimplifyWayActionTest {
 
     /** Class under test. */
     private static SimplifyWayAction action;
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java	(revision 18870)
@@ -8,5 +8,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -17,19 +16,11 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link SplitWayAction}.
  */
+@Projection
 final class SplitWayActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
     private final DataSet dataSet = new DataSet();
 
Index: /trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java	(revision 18870)
@@ -7,5 +7,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -14,22 +13,18 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link UnGlueAction}.
  */
+@BasicPreferences
+@Main
+@Projection
 final class UnGlueActionTest {
 
     /** Class under test. */
     private static UnGlueAction action;
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java	(revision 18870)
@@ -7,5 +7,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -14,11 +13,12 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link UnJoinNodeWayAction}.
  */
+@Main
+@Projection
 final class UnJoinNodeWayActionTest {
 
@@ -33,14 +33,7 @@
         @Override
         public void notify(String msg, int messageType) {
-            return;
+            // Do nothing
         }
     }
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public static JOSMTestRules test = new JOSMTestRules().projection().main();
 
     /**
@@ -65,5 +58,5 @@
 
         Way w = new Way();
-        w.setNodes(Arrays.asList(new Node[] {n1, n2, n3}));
+        w.setNodes(Arrays.asList(n1, n2, n3));
         dataSet.addPrimitive(w);
 
Index: /trunk/test/unit/org/openstreetmap/josm/actions/UploadActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/UploadActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/UploadActionTest.java	(revision 18870)
@@ -4,12 +4,12 @@
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import java.awt.GraphicsEnvironment;
 import java.util.Collections;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.command.AddPrimitivesCommand;
@@ -22,7 +22,7 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.util.GuiHelper;
-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.OsmApi;
 import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.testutils.annotations.Territories;
@@ -40,4 +40,5 @@
 @BasicPreferences
 @Main
+@OsmApi(OsmApi.APIType.FAKE)
 @Projection
 // Territories is needed due to test pollution. One of the listeners
@@ -47,14 +48,9 @@
 @Territories(Territories.Initialize.ALL)
 class UploadActionTest {
-    // Only needed for layer cleanup. And user identity cleanup. And ensuring that data isn't accidentally uploaded.
-    // Note that the setUp method can be replaced by the @Territories extension, when that is merged.
-    @RegisterExtension
-    static JOSMTestRules josmTestRules = new JOSMTestRules().fakeAPI();
-
     /**
      * Non-regression test for JOSM #21476.
      */
     @Test
-    void testNonRegression21476() {
+    void testNonRegression21476() throws ExecutionException, InterruptedException, TimeoutException {
         TestUtils.assumeWorkingJMockit();
         Logging.clearLastErrorAndWarnings();
@@ -84,6 +80,4 @@
             }).get(1, TimeUnit.SECONDS);
             assertTrue(Logging.getLastErrorAndWarnings().isEmpty());
-        } catch (Exception exception) {
-            fail(exception);
         } finally {
             Logging.clearLastErrorAndWarnings();
@@ -109,5 +103,5 @@
         public final boolean isCanceled(final Invocation invocation) {
             if (!GraphicsEnvironment.isHeadless()) {
-                return invocation.proceed();
+                return Boolean.TRUE.equals(invocation.proceed());
             }
             return true;
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java	(revision 18870)
@@ -5,5 +5,4 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -12,20 +11,13 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link AddNoteAction}.
  */
+@Main
+@Projection
 class AddNoteActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link AddNoteAction#enterMode} and {@link AddNoteAction#exitMode}.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java	(revision 18870)
@@ -5,5 +5,4 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -13,20 +12,13 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link DeleteAction}.
  */
+@Main
+@Projection
 class DeleteActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link DeleteAction#enterMode} and {@link DeleteAction#exitMode}.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java	(revision 18870)
@@ -14,6 +14,6 @@
 import javax.swing.JList;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -26,30 +26,22 @@
 import org.openstreetmap.josm.gui.PrimitiveRenderer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link DrawAction}.
  */
+@Main
+@Projection
+@Timeout(20)
 class DrawActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection().timeout(20000);
-
     /**
      * Non regression test case for bug #12011.
      * Add a new node in the middle of way then undo. The rendering of the node, selected, must not cause any crash in PrimitiveRenderer.
      * @throws SecurityException see {@link Class#getDeclaredField} for details
-     * @throws NoSuchFieldException see {@link Class#getDeclaredField} for details
-     * @throws IllegalAccessException see {@link Field#set} for details
      * @throws IllegalArgumentException see {@link Field#set} for details
      */
     @Test
-    void testTicket12011() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
+    void testTicket12011() throws IllegalArgumentException, SecurityException {
         DataSet dataSet = new DataSet();
         OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
@@ -67,5 +59,5 @@
 
         Way w = new Way();
-        w.setNodes(Arrays.asList(new Node[] {n1, n2}));
+        w.setNodes(Arrays.asList(n1, n2));
         dataSet.addPrimitive(w);
 
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawSnapHelperTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawSnapHelperTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawSnapHelperTest.java	(revision 18870)
@@ -11,5 +11,4 @@
 import javax.swing.JCheckBoxMenuItem;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -26,5 +25,5 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
 import org.openstreetmap.josm.tools.Utils;
 
@@ -32,8 +31,7 @@
  * Test class for {@link DrawSnapHelper}
  */
+@Main
+@org.openstreetmap.josm.testutils.annotations.Projection
 class DrawSnapHelperTest {
-    @RegisterExtension
-    static JOSMTestRules rule = new JOSMTestRules().projection().main();
-
     static Stream<Arguments> testNonRegression13097() {
         return Stream.of(
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java	(revision 18870)
@@ -5,5 +5,4 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -13,20 +12,13 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link ExtrudeAction}.
  */
+@Main
+@Projection
 class ExtrudeActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java	(revision 18870)
@@ -5,5 +5,4 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -13,20 +12,13 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link ImproveWayAccuracyAction}.
  */
+@Main
+@Projection
 class ImproveWayAccuracyActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link ImproveWayAccuracyAction#enterMode} and {@link ImproveWayAccuracyAction#exitMode}.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java	(revision 18870)
@@ -5,5 +5,4 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -14,20 +13,13 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link ParallelWayAction}.
  */
+@Main
+@Projection
 class ParallelWayActionTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link ParallelWayAction#enterMode} and {@link ParallelWayAction#exitMode}.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java	(revision 18870)
@@ -5,5 +5,4 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -12,20 +11,13 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.layer.markerlayer.PlayHeadMarker;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link PlayHeadDragMode}.
  */
+@Main
+@Projection
 class PlayHeadDragModeTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link PlayHeadDragMode#enterMode} and {@link PlayHeadDragMode#exitMode}.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java	(revision 18870)
@@ -13,5 +13,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.actions.mapmode.SelectAction.Mode;
@@ -26,5 +25,6 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.PlatformManager;
 import org.openstreetmap.josm.tools.ReflectionUtils;
@@ -35,4 +35,6 @@
  * Unit tests for class {@link SelectAction}.
  */
+@Main
+@Projection
 class SelectActionTest {
 
@@ -54,11 +56,4 @@
         }
     }
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().main();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java	(revision 18870)
@@ -12,5 +12,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.command.PseudoCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
@@ -21,20 +20,11 @@
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Unit tests for class {@link FixDataHook}.
  */
+@Main
 class FixDataHookTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Test of {@link FixDataHook#checkUpload} method.
Index: /trunk/test/unit/org/openstreetmap/josm/actions/upload/UploadNotesTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/upload/UploadNotesTaskTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/upload/UploadNotesTaskTest.java	(revision 18870)
@@ -15,5 +15,4 @@
 import java.util.stream.Stream;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -31,6 +30,6 @@
 import org.openstreetmap.josm.io.OsmTransferException;
 import org.openstreetmap.josm.testutils.FakeOsmApi;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
 import org.openstreetmap.josm.tools.Logging;
 
@@ -43,8 +42,6 @@
  */
 @BasicPreferences
+@OsmApi(OsmApi.APIType.FAKE)
 class UploadNotesTaskTest {
-    @RegisterExtension
-    static JOSMTestRules josmTestRules = new JOSMTestRules().fakeAPI();
-
     static Stream<Arguments> testUpload() {
         final NoteData commonData = new NoteData();
Index: /trunk/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java	(revision 18870)
@@ -8,8 +8,6 @@
 import java.util.stream.Stream;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import mockit.Mock;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -27,19 +25,19 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
+
+import mockit.Mock;
 
 /**
  * Unit tests for class {@link ValidateUploadHook}.
  */
+@Main
+@OsmApi(OsmApi.APIType.FAKE)
+@Projection
+@Timeout(30)
 class ValidateUploadHookTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection().fakeAPI().timeout(30000);
-
     /**
      * Test of {@link ValidateUploadHook#checkUpload} method.
Index: /trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java	(revision 18870)
@@ -14,5 +14,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
@@ -25,7 +24,8 @@
 import org.openstreetmap.josm.data.projection.ProjectionRegistry;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.I18n;
+import org.openstreetmap.josm.testutils.annotations.Projection;
+
 import nl.jqno.equalsverifier.EqualsVerifier;
 import nl.jqno.equalsverifier.Warning;
@@ -34,11 +34,8 @@
  * Unit tests of {@link MoveCommand} class.
  */
+@BasicPreferences
+@I18n
+@Projection
 class MoveCommandTest {
-    /**
-     * We need prefs for nodes.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().i18n().projection();
     private CommandTestDataWithRelation testData;
 
@@ -60,5 +57,5 @@
         EastNorth start = new EastNorth(2, 0);
 
-        Set<OsmPrimitive> nodeAsCollection = Collections.<OsmPrimitive>singleton(testData.existingNode);
+        Set<OsmPrimitive> nodeAsCollection = Collections.singleton(testData.existingNode);
         assertEquals(1, nodeAsCollection.size());
         checkCommandAfterConstructor(new MoveCommand(nodeAsCollection, offset));
@@ -221,5 +218,5 @@
         ArrayList<OsmPrimitive> deleted = new ArrayList<>();
         ArrayList<OsmPrimitive> added = new ArrayList<>();
-        new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2).fillModifiedData(modified,
+        new MoveCommand(Collections.singletonList(testData.existingNode), 1, 2).fillModifiedData(modified,
                 deleted, added);
         assertArrayEquals(new Object[] {testData.existingNode }, modified.toArray());
@@ -233,10 +230,10 @@
     @Test
     void testGetParticipatingPrimitives() {
-        MoveCommand command = new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2);
+        MoveCommand command = new MoveCommand(Collections.singletonList(testData.existingNode), 1, 2);
         command.executeCommand();
         assertArrayEquals(new Object[] {testData.existingNode}, command.getParticipatingPrimitives().toArray());
 
         MoveCommand command2 = new MoveCommand(
-                Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingWay), 1, 2);
+                Arrays.asList(testData.existingNode, testData.existingWay), 1, 2);
         command2.executeCommand();
         assertArrayEquals(new Object[] {testData.existingNode, testData.existingNode2},
@@ -251,7 +248,7 @@
         Node node = TestUtils.addFakeDataSet(new Node(LatLon.ZERO));
         node.put("name", "xy");
-        List<OsmPrimitive> nodeList = Arrays.<OsmPrimitive>asList(node);
+        List<OsmPrimitive> nodeList = Collections.singletonList(node);
         assertTrue(new MoveCommand(nodeList, 1, 2).getDescriptionText().matches("Move 1 node"));
-        List<OsmPrimitive> nodes = Arrays.<OsmPrimitive>asList(node, testData.existingNode, testData.existingNode2);
+        List<OsmPrimitive> nodes = Arrays.asList(node, testData.existingNode, testData.existingNode2);
         assertTrue(new MoveCommand(nodes, 1, 2).getDescriptionText().matches("Move 3 nodes"));
     }
Index: /trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java	(revision 18870)
@@ -7,8 +7,8 @@
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.command.CommandTest.CommandTestData;
@@ -20,7 +20,7 @@
 import org.openstreetmap.josm.data.osm.User;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import nl.jqno.equalsverifier.EqualsVerifier;
 import nl.jqno.equalsverifier.Warning;
@@ -29,12 +29,7 @@
  * Unit tests of {@link RotateCommand} class.
  */
+@BasicPreferences
+@Projection
 class RotateCommandTest {
-
-    /**
-     * We need prefs for nodes.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     private CommandTestData testData;
 
@@ -100,5 +95,5 @@
         ArrayList<OsmPrimitive> deleted = new ArrayList<>();
         ArrayList<OsmPrimitive> added = new ArrayList<>();
-        RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode),
+        RotateCommand command = new RotateCommand(Collections.singletonList(testData.existingNode),
                 new EastNorth(0, 0));
         // intentionally empty
@@ -114,5 +109,5 @@
     @Test
     void testGetParticipatingPrimitives() {
-        RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0));
+        RotateCommand command = new RotateCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0));
         command.executeCommand();
         assertArrayEquals(new Object[] {testData.existingNode}, command.getParticipatingPrimitives().toArray());
@@ -125,5 +120,5 @@
     void testDescription() {
         assertEquals("Rotate 1 node",
-                new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0))
+                new RotateCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0))
                         .getDescriptionText());
         assertEquals("Rotate 2 nodes",
Index: /trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java	(revision 18870)
@@ -7,8 +7,8 @@
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.command.CommandTest.CommandTestData;
@@ -20,7 +20,7 @@
 import org.openstreetmap.josm.data.osm.User;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import nl.jqno.equalsverifier.EqualsVerifier;
 import nl.jqno.equalsverifier.Warning;
@@ -29,12 +29,7 @@
  * Unit tests of {@link ScaleCommand} class.
  */
+@BasicPreferences
+@Projection
 class ScaleCommandTest {
-
-    /**
-     * We need prefs for nodes.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     private CommandTestData testData;
 
@@ -100,5 +95,5 @@
         ArrayList<OsmPrimitive> deleted = new ArrayList<>();
         ArrayList<OsmPrimitive> added = new ArrayList<>();
-        ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode),
+        ScaleCommand command = new ScaleCommand(Collections.singletonList(testData.existingNode),
                 new EastNorth(0, 0));
         // intentionally empty
@@ -114,5 +109,5 @@
     @Test
     void testGetParticipatingPrimitives() {
-        ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0));
+        ScaleCommand command = new ScaleCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0));
         command.executeCommand();
         assertArrayEquals(new Object[] {testData.existingNode }, command.getParticipatingPrimitives().toArray());
@@ -125,5 +120,5 @@
     void testDescription() {
         assertEquals("Scale 1 node",
-                new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0))
+                new ScaleCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0))
                         .getDescriptionText());
         assertEquals("Scale 2 nodes",
Index: /trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java	(revision 18870)
@@ -18,5 +18,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -38,20 +37,15 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link SplitWayCommand}.
  */
+@BasicPreferences
+@Main
+@Projection
 final class SplitWayCommandTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    static JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
-
     /**
      * Unit test of {@link SplitWayCommand#findVias}.
@@ -303,5 +297,5 @@
     /**
      * Non-regression test for issue #17400 (Warn when splitting way in not fully downloaded region)
-     *
+     * <p>
      * Bus route 190 gets broken when the split occurs, because the two new way parts are inserted in the relation in
      * the wrong order.
@@ -348,9 +342,9 @@
     /**
      * Non-regression test for issue #18863 (Asking for download of missing members when not needed)
-     *
+     * <p>
      * A split on node 4518025255 caused the 'download missing members?' dialog to pop up for relation 68745 (CB 2),
      * even though the way members next to the split way were already downloaded. This happened because this relation
      * does not have its members connected at all.
-     *
+     * <p>
      * This split should not trigger any download action at all.
      *
Index: /trunk/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java	(revision 18870)
@@ -10,4 +10,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
@@ -17,4 +18,5 @@
  * Unit tests of {@link DeletedStateConflictResolveCommand} class.
  */
+@MapPaintStyles
 class DeletedStateConflictResolveCommandTest {
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java	(revision 18870)
@@ -10,4 +10,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
@@ -17,4 +18,5 @@
  * Unit tests of {@link ModifiedConflictResolveCommand} class.
  */
+@MapPaintStyles
 class ModifiedConflictResolveCommandTest {
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java	(revision 18870)
@@ -10,4 +10,5 @@
 import org.openstreetmap.josm.data.osm.User;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
@@ -17,4 +18,5 @@
  * Unit tests of {@link RelationMemberConflictResolverCommand} class.
  */
+@MapPaintStyles
 class RelationMemberConflictResolverCommandTest {
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java	(revision 18870)
@@ -10,4 +10,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
@@ -17,4 +18,5 @@
  * Unit tests of {@link TagConflictResolveCommand} class.
  */
+@MapPaintStyles
 class TagConflictResolveCommandTest {
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java	(revision 18870)
@@ -10,4 +10,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
@@ -17,4 +18,5 @@
  * Unit tests of {@link VersionConflictResolveCommand} class.
  */
+@MapPaintStyles
 class VersionConflictResolveCommandTest {
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java	(revision 18870)
@@ -10,4 +10,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
@@ -17,4 +18,5 @@
  * Unit tests of {@link WayNodesConflictResolverCommand} class.
  */
+@MapPaintStyles
 class WayNodesConflictResolverCommandTest {
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java	(revision 18870)
@@ -4,22 +4,14 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
 
 /**
  * Unit tests of {@link Preferences}.
  */
+@BasicPreferences
+@OsmApi(OsmApi.APIType.FAKE)
 class PreferencesTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
-
     /**
      * Test {@link Preferences#toXML}.
Index: /trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java	(revision 18870)
@@ -13,24 +13,17 @@
 import org.apache.commons.jcs3.access.behavior.ICacheAccess;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.data.imagery.TMSCachedTileLoader;
 import org.openstreetmap.josm.data.imagery.TileJobOptions;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.tools.Logging;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
 /**
- * Simple tests for ThreadPoolExecutor / HostLimitQueue veryfing, that this pair works OK
+ * Simple tests for ThreadPoolExecutor / HostLimitQueue verifying, that this pair works OK
  * @author Wiktor Niesiobedzki
  */
+@BasicPreferences
+@Timeout(20)
 class HostLimitQueueTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20 * 1000);
-
     /**
      * Mock class for tests
Index: /trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java	(revision 18870)
@@ -11,8 +11,7 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.Bounds;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -22,13 +21,6 @@
  * Unit tests for class {@link LatLon}.
  */
+@Projection
 public class LatLonTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     private static final double EPSILON = 1e-6;
 
@@ -156,5 +148,5 @@
 
     /**
-     * Unit test of {@link LatLon#LatLon(LatLon)}.
+     * Unit test of {@link LatLon#LatLon(ILatLon)}.
      */
     @Test
Index: /trunk/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java	(revision 18870)
@@ -7,10 +7,8 @@
 import java.text.DecimalFormat;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import nl.jqno.equalsverifier.EqualsVerifier;
 
@@ -18,13 +16,6 @@
  * Test the {@link PolarCoor} class.
  */
+@Projection
 class PolarCoorTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     /**
      * Test {@link PolarCoor#PolarCoor}
Index: /trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java	(revision 18870)
@@ -4,23 +4,14 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.coor.ILatLon;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Test for {@link ICoordinateFormat} implementations.
  */
+@Projection
 class ICoordinateFormatTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     /**
      * Tests {@link ICoordinateFormat#latToString(org.openstreetmap.josm.data.coor.ILatLon)}
Index: /trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java	(revision 18870)
@@ -6,22 +6,12 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link LatLonParser}.
  */
+@Projection
 class LatLonParserTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     /**
      * Unit test of {@link LatLonParser#parse} method.
Index: /trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java	(revision 18870)
@@ -21,5 +21,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.Bounds;
@@ -32,10 +31,9 @@
 import org.openstreetmap.josm.data.projection.ProjectionRegistry;
 import org.openstreetmap.josm.io.GpxReaderTest;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.ListenerList;
 import org.openstreetmap.josm.tools.date.Interval;
 import org.xml.sax.SAXException;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import nl.jqno.equalsverifier.EqualsVerifier;
 import nl.jqno.equalsverifier.Warning;
@@ -44,13 +42,6 @@
  * Unit tests for class {@link GpxData}.
  */
+@Projection
 class GpxDataTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     private GpxData data;
 
@@ -339,6 +330,6 @@
         p2.setInstant(Instant.ofEpochMilli(200020));
 
-        data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p2)), Collections.emptyMap()));
-        data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1)), Collections.emptyMap()));
+        data.addTrack(new GpxTrack(Collections.singletonList(Collections.singletonList(p2)), Collections.emptyMap()));
+        data.addTrack(new GpxTrack(Collections.singletonList(Collections.singletonList(p1)), Collections.emptyMap()));
 
         List<IGpxTrack> tracks = data.getOrderedTracks();
@@ -364,6 +355,6 @@
         p2.setInstant(Instant.ofEpochMilli(100020));
         p4.setInstant(Instant.ofEpochMilli(500020));
-        data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1, p2)), Collections.emptyMap()));
-        data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
+        data.addTrack(new GpxTrack(Collections.singletonList(Arrays.asList(p1, p2)), Collections.emptyMap()));
+        data.addTrack(new GpxTrack(Collections.singletonList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
 
         Interval times = data.getMinMaxTimeForAllTracks().orElse(null);
@@ -383,5 +374,5 @@
                 .map(WayPoint::new)
                 .collect(Collectors.toList());
-        data.addTrack(new GpxTrack(Arrays.asList(points), Collections.emptyMap()));
+        data.addTrack(new GpxTrack(Collections.singletonList(points), Collections.emptyMap()));
 
         WayPoint closeToMiddle = data.nearestPointOnTrack(new EastNorth(10, 0), 10);
@@ -406,5 +397,5 @@
         DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test");
         data.dataSources.add(ds);
-        assertEquals(new ArrayList<>(Arrays.asList(ds)), new ArrayList<>(data.getDataSources()));
+        assertEquals(new ArrayList<>(Collections.singletonList(ds)), new ArrayList<>(data.getDataSources()));
     }
 
@@ -429,5 +420,5 @@
         DataSource ds = new DataSource(bounds, "test");
         data.dataSources.add(ds);
-        assertEquals(Arrays.asList(bounds), data.getDataSourceBounds());
+        assertEquals(Collections.singletonList(bounds), data.getDataSourceBounds());
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java	(revision 18870)
@@ -18,11 +18,12 @@
 import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.spi.preferences.Config;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 import com.github.tomakehurst.wiremock.WireMockServer;
 import com.github.tomakehurst.wiremock.client.WireMock;
 
-import org.openstreetmap.josm.testutils.annotations.Projection;
-
+@BasicPreferences(true)
 @BasicWiremock
 @Projection
Index: /trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyleTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyleTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyleTest.java	(revision 18870)
@@ -29,15 +29,8 @@
 
 import javax.imageio.ImageIO;
-import jakarta.json.Json;
-import jakarta.json.JsonObject;
-import jakarta.json.JsonObjectBuilder;
-import jakarta.json.JsonReader;
-import jakarta.json.JsonStructure;
-import jakarta.json.JsonValue;
 
 import org.awaitility.Awaitility;
 import org.awaitility.Durations;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.io.TempDir;
 import org.openstreetmap.josm.TestUtils;
@@ -49,8 +42,14 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule;
 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.tools.ColorHelper;
 import org.openstreetmap.josm.tools.ImageProvider;
 
+import jakarta.json.Json;
+import jakarta.json.JsonObject;
+import jakarta.json.JsonObjectBuilder;
+import jakarta.json.JsonReader;
+import jakarta.json.JsonStructure;
+import jakarta.json.JsonValue;
 import nl.jqno.equalsverifier.EqualsVerifier;
 
@@ -59,13 +58,11 @@
  * @author Taylor Smock
  */
-public class MapboxVectorStyleTest {
+// Needed for osm primitives (we really just need to initialize the config)
+// OSM primitives are called when we load style sources
+@BasicPreferences
+class MapboxVectorStyleTest {
     /** Used to store sprite files (specifically, sprite{,@2x}.{png,json}) */
     @TempDir
     File spritesDirectory;
-
-    // Needed for osm primitives (we really just need to initialize the config)
-    // OSM primitives are called when we load style sources
-    @RegisterExtension
-    JOSMTestRules rules = new JOSMTestRules();
 
     /** The base information */
@@ -87,9 +84,9 @@
     void testVersionChecks() {
         assertThrows(NullPointerException.class, () -> new MapboxVectorStyle(JsonValue.EMPTY_JSON_OBJECT));
-        IllegalArgumentException badVersion = assertThrows(IllegalArgumentException.class,
-          () -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 7).build()));
+        final JsonObject style7 = Json.createObjectBuilder().add("version", 7).build();
+        IllegalArgumentException badVersion = assertThrows(IllegalArgumentException.class, () -> new MapboxVectorStyle(style7));
         assertEquals("Vector Tile Style Version not understood: version 7 (json: {\"version\":7})", badVersion.getMessage());
-        badVersion = assertThrows(IllegalArgumentException.class,
-          () -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 9).build()));
+        final JsonObject style9 = Json.createObjectBuilder().add("version", 9).build();
+        badVersion = assertThrows(IllegalArgumentException.class, () -> new MapboxVectorStyle(style9));
         assertEquals("Vector Tile Style Version not understood: version 9 (json: {\"version\":9})", badVersion.getMessage());
         assertDoesNotThrow(() -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 8).build()));
Index: /trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java	(revision 18870)
@@ -6,24 +6,16 @@
 import java.io.InputStream;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of the {@code MultipolygonBuilder} class.
  */
+@Projection
+@Timeout(15)
 class MultipolygonBuilderTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().timeout(15000);
-
     /**
      * Non-regression test for ticket #12376.
Index: /trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java	(revision 18870)
@@ -6,29 +6,19 @@
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.DataSource;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of the {@code Node} class.
  */
+@Projection
 class NodeTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     /**
      * Non-regression test for ticket #12060.
Index: /trunk/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java	(revision 18870)
@@ -8,29 +8,19 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.notes.Note;
 import org.openstreetmap.josm.data.notes.Note.State;
 import org.openstreetmap.josm.data.notes.NoteComment;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 
 /**
  * Unit tests of the {@code NoteData} class.
  */
+@BasicPreferences
 class NoteDataTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences();
-
     /**
      * Unit test for {@link NoteData#NoteData}
@@ -40,5 +30,5 @@
         NoteData empty = new NoteData();
         assertEquals(0, empty.getNotes().size());
-        NoteData notEmpty = new NoteData(Arrays.asList(new Note(LatLon.ZERO)));
+        NoteData notEmpty = new NoteData(Collections.singletonList(new Note(LatLon.ZERO)));
         assertEquals(1, notEmpty.getNotes().size());
     }
@@ -54,5 +44,5 @@
         assertTrue(note.getComments().isEmpty());
 
-        NoteData data = new NoteData(Arrays.asList(note));
+        NoteData data = new NoteData(Collections.singletonList(note));
         data.closeNote(note, "foo");
 
Index: /trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java	(revision 18870)
@@ -4,23 +4,13 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
 
 /**
  * Unit tests of {@link JosmUrls} class.
  */
+@OsmApi(OsmApi.APIType.DEV)
 class JosmUrlsTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().devAPI();
-
     /**
      * Unit test of {@link JosmUrls#getBaseUserUrl}.
Index: /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java	(revision 18870)
@@ -37,10 +37,10 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.gui.preferences.projection.CodeProjectionChoice;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids;
 import org.openstreetmap.josm.tools.Pair;
 import org.openstreetmap.josm.tools.PlatformManager;
@@ -57,5 +57,5 @@
  * can be accessed, i.e. copy them from <code>nodist/data/projection</code> to <code>/usr/share/proj</code> or
  * wherever cs2cs expects them to be placed.
- *
+ * <p>
  * The input parameter for the external library is <em>not</em> the projection code
  * (e.g. "EPSG:25828"), but the entire definition, (e.g. "+proj=utm +zone=28 +ellps=GRS80 +nadgrids=null").
@@ -63,4 +63,6 @@
  * of the algorithm, given a certain definition.
  */
+@ProjectionNadGrids
+@Timeout(90)
 class ProjectionRefTest {
 
@@ -86,11 +88,4 @@
     static boolean debug;
     static List<String> forcedCodes;
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().timeout(90_000);
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java	(revision 18870)
@@ -25,4 +25,5 @@
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids;
 import org.openstreetmap.josm.tools.Pair;
 import org.openstreetmap.josm.tools.Platform;
@@ -138,4 +139,5 @@
      * @throws IOException if any I/O error occurs
      */
+    @ProjectionNadGrids
     @Test
     void testNonRegression() throws IOException {
Index: /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java	(revision 18870)
@@ -16,4 +16,5 @@
 import org.openstreetmap.josm.data.coor.ILatLon;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids;
 
 /**
@@ -30,4 +31,5 @@
      * Tests that projections are numerically stable in their definition bounds (round trip error &lt; 1e-5)
      */
+    @ProjectionNadGrids
     @Test
     void testProjections() {
Index: /trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java	(revision 18870)
@@ -7,24 +7,15 @@
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids;
 
 /**
  * Unit tests for the Swiss projection grid.
  */
+@ProjectionNadGrids
 class SwissGridTest {
     private static final String SWISS_EPSG_CODE = "EPSG:21781";
     private final boolean debug = false;
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projectionNadGrids();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java	(revision 18870)
@@ -8,9 +8,7 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.validation.tests.Addresses;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import net.trajano.commons.testing.UtilityClassTestUtil;
 
@@ -18,13 +16,6 @@
  * Unit tests for class {@link OsmValidator}.
  */
+@Projection
 class OsmValidatorTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     /**
      * Setup test.
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java	(revision 18870)
@@ -25,10 +25,4 @@
 import java.util.stream.Stream;
 
-import jakarta.json.Json;
-import jakarta.json.JsonObject;
-import jakarta.json.JsonReader;
-
-import mockit.Mock;
-import mockit.MockUp;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -50,7 +44,14 @@
 import org.openstreetmap.josm.testutils.annotations.AnnotationUtils;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Territories;
 import org.openstreetmap.josm.testutils.annotations.ThreadSync;
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.Utils;
+
+import jakarta.json.Json;
+import jakarta.json.JsonObject;
+import jakarta.json.JsonReader;
+import mockit.Mock;
+import mockit.MockUp;
 
 /**
@@ -59,4 +60,5 @@
  */
 @BasicPreferences
+@Territories
 class ValidatorCLITest {
     @RegisterExtension
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java	(revision 18870)
@@ -7,22 +7,13 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
 
 /**
  * Unit test of {@link ConditionalKeys}.
  */
+@TaggingPresets
 class ConditionalKeysTest {
 
     private final ConditionalKeys test = new ConditionalKeys();
-
-    /**
-     * Setup test
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rule = new JOSMTestRules().presets();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java	(revision 18870)
@@ -12,5 +12,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -25,20 +24,13 @@
 import org.openstreetmap.josm.data.validation.tests.CrossingWays.Ways;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit test of {@link CrossingWays}.
  */
+@BasicPreferences
+@Projection
 class CrossingWaysTest {
-
-    /**
-     * Setup test
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rule = new JOSMTestRules().preferences().projection();
-
     private static Way newUsableWay(String tags) {
         return TestUtils.newWay(tags, new Node(LatLon.NORTH_POLE), new Node(LatLon.ZERO));
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java	(revision 18870)
@@ -8,26 +8,23 @@
 import java.util.stream.Collectors;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
+import org.openstreetmap.josm.testutils.annotations.Projection;
+import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
 
 /**
  * JUnit Test of Multipolygon validation test.
  */
+@BasicPreferences
+@Main
+@MapPaintStyles
+@Projection
+@TaggingPresets
 class MultipolygonTestTest {
-
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main().preferences();
-
     /**
      * Test all error cases manually created in multipolygon.osm.
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java	(revision 18870)
@@ -9,5 +9,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.osm.Node;
@@ -17,19 +16,11 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
 
 /**
  * Unit tests of {@link RelationChecker} class.
  */
+@TaggingPresets
 class RelationCheckerTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rule = new JOSMTestRules().presets();
-
     private static RelationChecker getRelationChecker() {
         RelationChecker checker = new RelationChecker();
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java	(revision 18870)
@@ -14,5 +14,4 @@
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -21,20 +20,11 @@
 import org.openstreetmap.josm.data.validation.Severity;
 import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
 
 /**
  * JUnit Test of {@link TagChecker}.
  */
+@TaggingPresets
 class TagCheckerTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rule = new JOSMTestRules().presets();
-
     List<TestError> test(OsmPrimitive primitive) throws IOException {
         final TagChecker checker = new TagChecker() {
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java	(revision 18870)
@@ -2,25 +2,22 @@
 package org.openstreetmap.josm.data.validation.tests;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
+import org.openstreetmap.josm.testutils.annotations.Projection;
+import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
 
 /**
  * JUnit Test of turn restriction validation test.
  */
+@Main
+@MapPaintStyles
+@Projection
+@TaggingPresets
 class TurnRestrictionTestTest {
 
     private static final TurnrestrictionTest TURNRESTRICTION_TEST = new TurnrestrictionTest();
     private static final RelationChecker RELATION_TEST = new RelationChecker();
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java	(revision 18870)
@@ -9,5 +9,4 @@
 import java.util.List;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -19,20 +18,15 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.mappaint.ElemStyles;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
+import org.openstreetmap.josm.testutils.annotations.Projection;
+import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
 
 /**
  * JUnit Test of unclosed ways validation test.
  */
+@MapPaintStyles
+@Projection
+@TaggingPresets
 class UnclosedWaysTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets();
-
     private static Way createUnclosedWay(String tags, DataSet ds) {
         List<Node> nodes = new ArrayList<>();
Index: /trunk/test/unit/org/openstreetmap/josm/data/vector/VectorDataSetTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/vector/VectorDataSetTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/vector/VectorDataSetTest.java	(revision 18870)
@@ -15,5 +15,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.RepeatedTest;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
@@ -22,9 +21,10 @@
 import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MapboxVectorTileSource;
 import org.openstreetmap.josm.gui.layer.imagery.MVTLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * A test for {@link VectorDataSet}
  */
+@Projection
 class VectorDataSetTest {
     /**
@@ -63,7 +63,4 @@
         }
     }
-
-    @RegisterExtension
-    JOSMTestRules rule = new JOSMTestRules().projection();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/data/vector/VectorNodeTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/vector/VectorNodeTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/data/vector/VectorNodeTest.java	(revision 18870)
@@ -14,5 +14,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -25,5 +24,5 @@
 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
 import org.openstreetmap.josm.data.projection.ProjectionRegistry;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
@@ -32,8 +31,6 @@
  * @since 17862
  */
+@Projection
 class VectorNodeTest {
-    @RegisterExtension
-    JOSMTestRules rule = new JOSMTestRules().projection();
-
     @Test
     void testLatLon() {
Index: /trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java	(revision 18870)
@@ -8,5 +8,4 @@
 import java.awt.Color;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -14,20 +13,13 @@
 import org.openstreetmap.josm.gui.MapScaler.AccessibleMapScaler;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link MapScaler} class.
  */
+@Main
+@Projection
 class MapScalerTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link MapScaler#MapScaler}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java	(revision 18870)
@@ -9,8 +9,6 @@
 import java.util.function.Function;
 
-import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -18,4 +16,5 @@
 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint;
 import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
@@ -23,4 +22,5 @@
  * @author Michael Zangl
  */
+@Projection
 class MapViewStateTest {
 
@@ -28,12 +28,4 @@
     private static final int HEIGHT = 200;
     private MapViewState state;
-
-    /**
-     * Setup test.
-     */
-    @BeforeAll
-    public static void setUpBeforeClass() {
-        JOSMFixture.createUnitTestFixture().init();
-    }
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java	(revision 18870)
@@ -22,5 +22,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.ProjectionBounds;
@@ -32,7 +31,6 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.util.GuiHelper;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
@@ -41,4 +39,6 @@
  *
  */
+@BasicPreferences
+@Projection // We need the projection for coordinate conversions.
 class NavigatableComponentTest {
 
@@ -63,11 +63,4 @@
     private static final int WIDTH = 300;
     private NavigatableComponentMock component;
-
-    /**
-     * We need the projection for coordinate conversions.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
 
     /**
@@ -265,5 +258,5 @@
     /**
      * Check that EastNorth is the same as expected after zooming the NavigatableComponent.
-     *
+     * <p>
      * Adds tolerance of 0.5 pixel for pixel grid alignment, see
      * {@link NavigatableComponent#zoomTo(EastNorth, double, boolean)}
Index: /trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java	(revision 18870)
@@ -15,12 +15,9 @@
 import javax.swing.table.TableCellRenderer;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.ReflectionUtils;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
@@ -29,9 +26,9 @@
  * {@link TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
  * java.lang.Object, boolean, boolean, int, int)}.
- *
+ * <p>
  * For unknown reason java sometimes call getTableCellRendererComponent method
  * with value = null. Every implementation of {@code getTableCellRendererComponent}
  * must fail gracefully when null is passed as value parameter.
- *
+ * <p>
  * This test scans the classpath for classes implementing {@code TableCellRenderer},
  * creates an instance and calls {@code getTableCellRendererComponent} with null
@@ -40,4 +37,5 @@
  * @see <a href="https://josm.openstreetmap.de/ticket/6301">#6301</a>
  */
+@Main
 class TableCellRendererTest {
 
@@ -49,18 +47,8 @@
 
     /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
-    /**
      * Unit test of all table cell renderers against null values.
-     * @throws NoSuchMethodException no default constructor - to fix this, add a default constructor to the class
-     *                               or add the class to the SKIP_TEST list above
-     * @throws ReflectiveOperationException if an error occurs
      */
     @Test
-    void testTableCellRenderer() throws ReflectiveOperationException {
+    void testTableCellRenderer() {
         Set<Class<? extends TableCellRenderer>> renderers = TestUtils.getJosmSubtypes(TableCellRenderer.class);
         assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken
Index: /trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java	(revision 18870)
@@ -9,5 +9,4 @@
 import java.util.stream.Stream;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
@@ -26,19 +25,15 @@
 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link OsmTransferHandler} class.
  */
+@BasicPreferences
+@Main
+@Projection
 class OsmTransferHandlerTest {
-    /**
-     * Prefs to use OSM primitives
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection().main();
-
     private final OsmTransferHandler transferHandler = new OsmTransferHandler();
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java	(revision 18870)
@@ -5,5 +5,4 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -14,20 +13,15 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link CommandStackDialog} class.
  */
+@BasicPreferences
+@Main
+@Projection
 class CommandStackDialogTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
-
     /**
      * Unit test of {@link CommandStackDialog} class - empty case.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/FilterDialogTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/FilterDialogTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/FilterDialogTest.java	(revision 18870)
@@ -12,10 +12,9 @@
 import javax.swing.AbstractAction;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 import org.openstreetmap.josm.data.osm.Filter;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
 import org.openstreetmap.josm.tools.ReflectionUtils;
 
@@ -23,11 +22,9 @@
  * Test class for {@link FilterDialog}
  */
-@BasicPreferences
+@BasicPreferences(true)
+@Main
 class FilterDialogTest {
     private static final List<Filter> FILTERS = Stream.of("type:node", "type:way", "type:relation")
             .map(Filter::readFromString).map(Filter::new).collect(Collectors.toList());
-
-    @RegisterExtension
-    static JOSMTestRules josmTestRules = new JOSMTestRules().main();
 
     @ParameterizedTest
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java	(revision 18870)
@@ -12,5 +12,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.SystemOfMeasurement;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -21,20 +20,15 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link InspectPrimitiveDialog} class.
  */
+@Main
+@MapPaintStyles
+@Projection
 class InspectPrimitiveDialogTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    static JOSMTestRules test = new JOSMTestRules().main().projection().mapStyles();
-
     /**
      * Setup test
@@ -43,5 +37,4 @@
     public void setUp() {
         SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.put("METRIC");
-
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java	(revision 18870)
@@ -2,25 +2,17 @@
 package org.openstreetmap.josm.gui.dialogs;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link MapPaintDialog} class.
  */
+@Main
+@Projection
 class MapPaintDialogTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link MapPaintDialog.InfoAction} class.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java	(revision 18870)
@@ -18,5 +18,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -36,6 +35,7 @@
 import org.openstreetmap.josm.gui.widgets.JosmTextField;
 import org.openstreetmap.josm.spi.preferences.Config;
-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.mockers.ExtendedDialogMocker;
 
@@ -44,8 +44,8 @@
  */
 @BasicPreferences
+/* Only needed for {@link #testTicket21558} */
+@Main
+@Projection
 class NotesDialogTest {
-    /** Only needed for {@link #testTicket21558} */
-    @RegisterExtension
-    JOSMTestRules rules = new JOSMTestRules().main().projection();
     private Note createMultiLineNote() {
         Note note = new Note(LatLon.ZERO);
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java	(revision 18870)
@@ -2,24 +2,16 @@
 package org.openstreetmap.josm.gui.dialogs.changeset;
 
-import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Unit tests of {@link ChangesetContentPanel} class.
  */
+@BasicPreferences
+@Main
 class ChangesetContentPanelTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().main();
-
     /**
      * Unit test of {@link ChangesetContentPanel#ChangesetContentPanel}.
@@ -27,5 +19,5 @@
     @Test
     void testChangesetContentPanel() {
-        assertNotNull(new ChangesetContentPanel());
+        assertDoesNotThrow(ChangesetContentPanel::new);
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java	(revision 18870)
@@ -7,5 +7,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
@@ -14,19 +13,15 @@
 import org.openstreetmap.josm.gui.layer.TMSLayer;
 import org.openstreetmap.josm.gui.layer.TMSLayerTest;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link LayerVisibilityAction} class.
  */
+@BasicPreferences
+@Main
+@Projection
 class LayerVisibilityActionTest {
-    /**
-     * TMS layer needs prefs. Platform for LayerListDialog shortcuts.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection().main();
-
     /**
      * Unit test of {@link LayerVisibilityAction} class.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java	(revision 18870)
@@ -10,22 +10,12 @@
 import javax.swing.table.DefaultTableModel;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 
 /**
  * Unit tests of {@link PropertiesCellRenderer} class.
  */
+@BasicPreferences
 class PropertiesCellRendererTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences();
-
     /**
      * Test of color rendering.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java	(revision 18870)
@@ -13,5 +13,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -26,6 +25,7 @@
 import org.openstreetmap.josm.gui.PrimitiveHoverListener;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-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.tools.ReflectionUtils;
 
@@ -33,8 +33,8 @@
  * Unit tests of {@link PropertiesDialog} class.
  */
-@BasicPreferences
+@BasicPreferences(true)
+@Main
+@Projection
 class PropertiesDialogTest {
-    @RegisterExtension
-    static JOSMTestRules rules = new JOSMTestRules().main().projection();
 
     private static String createSearchSetting(List<OsmPrimitive> sel, boolean sameType) {
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java	(revision 18870)
@@ -8,5 +8,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -23,7 +22,6 @@
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetHandler;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
@@ -32,12 +30,7 @@
  */
 @Disabled
+@BasicPreferences
+@Main
 public abstract class AbstractRelationEditorActionTest {
-    /**
-     * Platform for tooltips.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().main();
-
     protected OsmDataLayer layer;
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java	(revision 18870)
@@ -13,5 +13,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -20,22 +19,16 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link RelationSorter} class.
  */
+@BasicPreferences
+@Projection
 class RelationSorterTest {
 
     private final RelationSorter sorter = new RelationSorter();
     private DataSet testDataset;
-
-    /**
-     * Use Mercator projection
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java	(revision 18870)
@@ -18,5 +18,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -27,11 +26,12 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link WayConnectionTypeCalculator} class.
  */
+@BasicPreferences
+@Projection
 class WayConnectionTypeCalculatorTest {
 
@@ -39,11 +39,4 @@
     private final WayConnectionTypeCalculator wayConnectionTypeCalculator = new WayConnectionTypeCalculator();
     private DataSet testDataset;
-
-    /**
-     * Use Mercator projection
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java	(revision 18870)
@@ -6,21 +6,11 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.junit.jupiter.api.Timeout;
 
 /**
  * Unit tests of {@link HelpContentReader} class.
  */
+@Timeout(30)
 class HelpContentReaderTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().timeout(30000);
-
     /**
      * Unit test of {@link HelpContentReader#fetchHelpTopicContent} - null case.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java	(revision 18870)
@@ -8,6 +8,8 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
+import java.awt.Color;
+
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
@@ -17,22 +19,14 @@
 import org.openstreetmap.josm.data.osm.history.HistoryDataSet;
 import org.openstreetmap.josm.data.osm.history.HistoryNode;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-import java.awt.Color;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
 
 /**
  * Unit tests of {@link HistoryBrowserModel} class.
  */
+@BasicPreferences
+@OsmApi(OsmApi.APIType.DEV)
+@Timeout(30)
 class HistoryBrowserModelTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(30000);
-
     /**
      * Test for {@link HistoryBrowserModel#HistoryBrowserModel}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java	(revision 18870)
@@ -7,6 +7,6 @@
 import java.io.InputStream;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.osm.Node;
@@ -22,21 +22,15 @@
 import org.openstreetmap.josm.io.OsmServerHistoryReader;
 import org.openstreetmap.josm.io.OsmTransferException;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
 import org.xml.sax.SAXException;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link HistoryLoadTask} class.
  */
+@BasicPreferences
+@OsmApi(OsmApi.APIType.DEV)
+@Timeout(20)
 class HistoryLoadTaskTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000);
-
     /**
      * Unit test of {@link HistoryLoadTask#getLoadingMessage}
Index: /trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java	(revision 18870)
@@ -13,5 +13,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.APIDataSet;
@@ -23,12 +22,11 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.io.UploadStrategySpecification;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link AsynchronousUploadPrimitivesTask}.
  */
+@AssertionsInEDT
 class AsynchronousUploadPrimitivesTaskTest {
 
@@ -38,11 +36,4 @@
     private Changeset changeset;
     private AsynchronousUploadPrimitivesTask uploadPrimitivesTask;
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().assertionsInEDT();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java	(revision 18870)
@@ -15,5 +15,4 @@
 
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -21,10 +20,10 @@
 import org.openstreetmap.josm.gui.oauth.OAuthAuthorizationWizard;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
 import org.openstreetmap.josm.testutils.mockers.WindowMocker;
 import org.openstreetmap.josm.tools.UserCancelException;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import mockit.Invocation;
 import mockit.Mock;
@@ -34,13 +33,7 @@
  * Unit tests of {@link DownloadOpenChangesetsTask} class.
  */
+@BasicPreferences
+@OsmApi(OsmApi.APIType.DEV)
 class DownloadOpenChangesetsTaskTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();
-
     /**
      * OAuth wizard mocker.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java	(revision 18870)
@@ -6,28 +6,22 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import java.util.Arrays;
+import java.util.Collections;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
 import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
 
 /**
  * Unit tests of {@link DownloadPrimitivesTask} class.
  */
+@BasicPreferences
+@OsmApi(OsmApi.APIType.DEV)
+@Timeout(20)
 class DownloadPrimitivesTaskTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000);
-
     /**
      * Test of {@link DownloadPrimitivesTask} class.
@@ -38,5 +32,5 @@
         assertTrue(ds.allPrimitives().isEmpty());
         SimplePrimitiveId pid = new SimplePrimitiveId(1, OsmPrimitiveType.NODE);
-        new DownloadPrimitivesTask(new OsmDataLayer(ds, "", null), Arrays.asList(pid), true).run();
+        new DownloadPrimitivesTask(new OsmDataLayer(ds, "", null), Collections.singletonList(pid), true).run();
         assertFalse(ds.allPrimitives().isEmpty());
         assertNotNull(ds.getPrimitiveById(pid));
Index: /trunk/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java	(revision 18870)
@@ -4,24 +4,16 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.io.UploadStrategy;
 import org.openstreetmap.josm.io.UploadStrategySpecification;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.OsmApi;
 
 /**
  * Unit tests of {@link UploadStrategySelectionPanel} class.
  */
+@BasicPreferences
+@OsmApi(OsmApi.APIType.DEV)
 class UploadStrategySelectionPanelTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();
-
     /**
      * Test of {@link UploadStrategySelectionPanel#UploadStrategySelectionPanel}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java	(revision 18870)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.gui.layer;
 
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -14,5 +15,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.gui.jmapviewer.Coordinate;
 import org.openstreetmap.gui.jmapviewer.Projected;
@@ -32,20 +32,13 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.imagery.ImageryFilterSettings;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Test of the base {@link AbstractTileSourceLayer} class
  */
+@Projection
+@Main
 class AbstractTileSourceLayerTest {
-
-    /**
-     * Setup test
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().main();
-
     private static final class TMSTileStubSource extends AbstractTMSTileSource {
         private TMSTileStubSource() {
@@ -203,5 +196,5 @@
     @Test
     void testTileSourceLayerPopup() {
-        assertNotNull(testLayer.new TileSourceLayerPopup(100, 100));
+        assertDoesNotThrow(() -> testLayer.new TileSourceLayerPopup(100, 100));
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java	(revision 18870)
@@ -23,5 +23,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -29,19 +28,14 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.AutosaveTask.AutosaveLayerInfo;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for class {@link AutosaveTask}.
  */
+/* We need preferences and a home directory for this. */
+@BasicPreferences
+@Projection
 class AutosaveTaskTest {
-    /**
-     * We need preferences and a home directory for this.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
-
     private AutosaveTask task;
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java	(revision 18870)
@@ -12,9 +12,7 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.projection.ProjectionRegistry;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
@@ -22,12 +20,8 @@
  * @author Michael Zangl
  */
+@BasicPreferences
+/* We need projection */
+@Projection
 class LayerTest {
-    /**
-     * We need projection
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
-
     private Layer testLayer;
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java	(revision 18870)
@@ -16,5 +16,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.actions.ExpertToggleAction;
@@ -35,22 +34,15 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
 import org.openstreetmap.josm.tools.Logging;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link OsmDataLayer} class.
  */
+@Main
+@Projection
 class OsmDataLayerTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().main();
-
     private DataSet ds;
     private OsmDataLayer layer;
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java	(revision 18870)
@@ -5,24 +5,16 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
 import org.openstreetmap.josm.gui.MainApplication;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link TMSLayer} class.
  */
+@Main
+@Projection
 public class TMSLayerTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Creates a new TMS layer.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java	(revision 18870)
@@ -7,24 +7,16 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.gui.MainApplication;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link ValidatorLayer} class.
  */
+@Main
+@Projection
 class ValidatorLayerTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().main();
-
     /**
      * Unit test of {@link ValidatorLayer#ValidatorLayer}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java	(revision 18870)
@@ -6,24 +6,16 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
 import org.openstreetmap.josm.gui.MainApplication;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link WMSLayer} class.
  */
+@Main
+@Projection
 class WMSLayerTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().projection();
-
     /**
      * Unit test of {@link WMSLayer#WMSLayer}.
@@ -46,5 +38,6 @@
     @Test
     void testTicket13828() {
-        assertThrows(IllegalArgumentException.class, () -> new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png")));
+        final ImageryInfo info = new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png");
+        assertThrows(IllegalArgumentException.class, () -> new WMSLayer(info));
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java	(revision 18870)
@@ -4,24 +4,16 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 
 /**
  * Unit tests of {@link WMTSLayer} class.
  */
+@BasicPreferences
+@Timeout(20)
 class WMTSLayerTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000);
-
     /**
      * Unit test of {@link WMTSLayer#WMTSLayer}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java	(revision 18870)
@@ -6,11 +6,9 @@
 import java.util.Collections;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
-
-import org.junit.jupiter.api.Test;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
@@ -19,8 +17,6 @@
 // Basic preferences are needed for OSM primitives
 @BasicPreferences
+@Main
 class GeoImageLayerTest {
-    @RegisterExtension
-    static JOSMTestRules josmTestRules = new JOSMTestRules().main();
-
     /**
      * Test that {@link GeoImageLayer#mergeFrom} throws IAE for invalid arguments
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoaderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoaderTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoaderTest.java	(revision 18870)
@@ -11,25 +11,15 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.GpxLayer;
 import org.openstreetmap.josm.io.GpxReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 
 /**
  * Unit tests of {@link ImagesLoader} class.
  */
+@BasicPreferences
 class ImagesLoaderTest {
-
-    /**
-     * We need prefs for this.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences();
-
     /**
      * Unit test of {@link ImagesLoader} class.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/MVTLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/MVTLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/MVTLayerTest.java	(revision 18870)
@@ -16,5 +16,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
@@ -34,6 +33,7 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.testutils.FakeGraphics;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.HTTP;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
@@ -41,9 +41,8 @@
  */
 @BasicPreferences
+@HTTP
+@Main
+@org.openstreetmap.josm.testutils.annotations.Projection
 class MVTLayerTest {
-    // Needed for setting HTTP factory and the main window/mapview
-    @RegisterExtension
-    JOSMTestRules josmTestRules = new JOSMTestRules().main().projection();
-
     MVTLayer testLayer;
 
@@ -56,20 +55,20 @@
 
     @Test
-    void getTileLoaderClass() {
+    void testGetTileLoaderClass() {
         assertEquals(MapboxVectorCachedTileLoader.class, this.testLayer.getTileLoaderClass());
     }
 
     @Test
-    void getCacheName() {
+    void testGetCacheName() {
         assertEquals("MVT", this.testLayer.getCacheName());
     }
 
     @Test
-    void getCache() {
+    void testGetCache() {
         assertNotNull(MVTLayer.getCache());
     }
 
     @Test
-    void getNativeProjections() {
+    void testGetNativeProjections() {
         assertArrayEquals(Collections.singleton(MVTFile.DEFAULT_PROJECTION).toArray(), this.testLayer.getNativeProjections().toArray());
     }
@@ -82,5 +81,5 @@
     @ParameterizedTest
     @ValueSource(strings = {"EPSG:3857" /* WGS 84 */, "EPSG:4326" /* Mercator (default) */, "EPSG:32612" /* UTM 12 N */})
-    void ensureDifferentProjectionsAreFetched(final String projectionCode) throws ReflectiveOperationException {
+    void testEnsureDifferentProjectionsAreFetched(final String projectionCode) throws ReflectiveOperationException {
         final Projection originalProjection = ProjectionRegistry.getProjection();
         try {
@@ -104,10 +103,10 @@
 
     @Test
-    void getTileSource() {
+    void testGetTileSource() {
         assertEquals(this.testLayer.getInfo().getUrl(), this.testLayer.getTileSource().getBaseUrl());
     }
 
     @Test
-    void createTile() {
+    void testCreateTile() {
         assertNotNull(this.testLayer.createTile(this.testLayer.getTileSource(), 3251, 6258, 14));
     }
@@ -115,5 +114,5 @@
     @ParameterizedTest
     @ValueSource(booleans = {true, false})
-    void getMenuEntries(final boolean isExpert) {
+    void testGetMenuEntries(final boolean isExpert) {
         ExpertToggleAction.getInstance().setExpert(isExpert);
         // For now, just ensure that nothing throws on implementation
@@ -123,10 +122,10 @@
 
     @Test
-    void getData() {
+    void testGetData() {
         assertNotNull(this.testLayer.getData());
     }
 
     @Test
-    void finishedLoading() throws ReflectiveOperationException {
+    void testFinishedLoading() throws ReflectiveOperationException {
         final MVTTile mvtTile = (MVTTile) this.testLayer.createTile(this.testLayer.getTileSource(), 3248, 6258, 14);
         final FinishedLoading finishedLoading = new FinishedLoading();
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java	(revision 18870)
@@ -9,11 +9,10 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.data.gpx.WayPoint;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
@@ -21,8 +20,6 @@
  */
 @BasicPreferences
+@Main
 class ImageMarkerTest {
-    @RegisterExtension
-    static JOSMTestRules josmTestRules = new JOSMTestRules().main();
-
     /**
      * Unit test of {@link ImageMarker#ImageMarker}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java	(revision 18870)
@@ -7,9 +7,8 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import java.util.Arrays;
+import java.util.Collections;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.gpx.GpxConstants;
@@ -22,20 +21,15 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link MarkerLayer} class.
  */
+@BasicPreferences
+@Main
+@Projection
 class MarkerLayerTest {
-
-    /**
-     * For creating layers
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().preferences().projection();
-
     /**
      * Setup tests
@@ -63,5 +57,5 @@
         GpxData gpx = new GpxData();
         WayPoint wpt = new WayPoint(LatLon.ZERO);
-        wpt.attr.put(GpxConstants.META_LINKS, Arrays.asList(new GpxLink("https://josm.openstreetmap.de")));
+        wpt.attr.put(GpxConstants.META_LINKS, Collections.singletonList(new GpxLink("https://josm.openstreetmap.de")));
         wpt.getExtensions().add("josm", "offset", "1.0");
         gpx.waypoints.add(wpt);
Index: /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java	(revision 18870)
@@ -13,5 +13,4 @@
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -25,21 +24,13 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector;
 import org.openstreetmap.josm.io.OsmReader;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link ChildOrParentSelector}.
  */
+@Projection
 class ChildOrParentSelectorTest {
 
     private DataSet ds;
-
-    /**
-     * Setup rule
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java	(revision 18870)
@@ -33,4 +33,5 @@
 import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
 import org.openstreetmap.josm.testutils.annotations.Projection;
 
@@ -172,4 +173,5 @@
      * Unit test of {@link Functions#JOSM_pref}, color handling
      */
+    @MapPaintStyles
     @Test
     void testPrefColor() {
Index: /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java	(revision 18870)
@@ -17,5 +17,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.EnumSource;
@@ -32,22 +31,14 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyCondition;
 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.Logging;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link KeyCondition}.
  */
+@Projection
 class KeyConditionTest {
 
     private DataSet ds;
-
-    /**
-     * Setup rule
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
 
     /**
@@ -166,5 +157,5 @@
      * If this fails, and the key should not be fully matched against (i.e., it is a regex), please modify
      * {@link MapCSSRuleIndex#findAnyRequiredKey}.
-     *
+     * <p>
      * Non-regression test for JOSM #22073.
      */
Index: /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java	(revision 18870)
@@ -10,5 +10,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -22,22 +21,14 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.Logging;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link KeyValueCondition}.
  */
+@Projection
 class KeyValueConditionTest {
 
     private DataSet ds;
-
-    /**
-     * Setup rule
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java	(revision 18870)
@@ -18,5 +18,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
@@ -43,12 +42,11 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser;
 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.ColorHelper;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link MapCSSParser}.
  */
+@Projection
 class MapCSSParserTest {
 
@@ -60,11 +58,4 @@
         return new MapCSSParser(new StringReader(stringToParse));
     }
-
-    /**
-     * Setup rule
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
 
     @Test
Index: /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java	(revision 18870)
@@ -4,24 +4,14 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@code ParsingLinkSelector}.
  */
+@Projection
 class ParsingLinkSelectorTest {
-
-    /**
-     * Setup rule
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection();
-
     @Test
-    public void parseEmptyChildSelector() {
+    void testParseEmptyChildSelector() {
         String css = "relation > way {}";
         MapCSSStyleSource source = new MapCSSStyleSource(css);
@@ -31,5 +21,5 @@
 
     @Test
-    public void parseEmptyParentSelector() {
+    void testParseEmptyParentSelector() {
         String css = "way < relation {}";
         MapCSSStyleSource source = new MapCSSStyleSource(css);
@@ -39,5 +29,5 @@
 
     @Test
-    public void parseChildSelectorWithKeyValueCondition() {
+    void testParseChildSelectorWithKeyValueCondition() {
         String css = "relation >[role=\"my_role\"] way {}";
         MapCSSStyleSource source = new MapCSSStyleSource(css);
@@ -47,5 +37,5 @@
 
     @Test
-    public void parseChildSelectorWithKeyCondition() {
+    void testParseChildSelectorWithKeyCondition() {
         String css = "relation >[\"my_role\"] way{}";
         MapCSSStyleSource source = new MapCSSStyleSource(css);
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java	(revision 18870)
@@ -6,24 +6,17 @@
 import javax.swing.JOptionPane;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.Preferences;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link ExportProfileAction} class.
  */
+@AssertionsInEDT
+@BasicPreferences
 class ExportProfileActionTest {
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
-
     /**
      * Unit test of {@link ExportProfileAction#actionPerformed}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java	(revision 18870)
@@ -7,9 +7,8 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import java.util.Arrays;
+import java.util.Collections;
 
 import javax.swing.JOptionPane;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -17,21 +16,15 @@
 import org.openstreetmap.josm.gui.preferences.advanced.PreferencesTable.AllSettingsTableModel;
 import org.openstreetmap.josm.spi.preferences.StringSetting;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link PreferencesTable} class.
  */
+@AssertionsInEDT
+@BasicPreferences
 class PreferencesTableTest {
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
-
     private static PrefEntry newPrefEntry(String value) {
         StringSetting val = new StringSetting(value);
@@ -41,5 +34,5 @@
 
     private static PreferencesTable newTable() {
-        return new PreferencesTable(Arrays.asList(newPrefEntry("value")));
+        return new PreferencesTable(Collections.singletonList(newPrefEntry("value")));
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java	(revision 18870)
@@ -5,27 +5,17 @@
 
 import java.io.File;
-import java.util.Arrays;
+import java.util.Collections;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Unit tests of {@link ImageryPreference} class.
  */
+@Main
 class ImageryPreferenceTest {
-
-    /**
-     * Setup tests
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Unit test of {@link ImageryPreference#ImageryPreference}.
@@ -42,5 +32,5 @@
     void testAddGui() {
         String fileUrl = new File(TestUtils.getTestDataRoot()+"__files/imagery/maps.xml").toURI().toString();
-        Config.getPref().putList("imagery.layers.sites", Arrays.asList(fileUrl));
+        Config.getPref().putList("imagery.layers.sites", Collections.singletonList(fileUrl));
         PreferencesTestUtils.doTestPreferenceSettingAddGui(new ImageryPreference.Factory(), null);
     }
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java	(revision 18870)
@@ -29,4 +29,5 @@
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.parallel.Execution;
@@ -435,4 +436,5 @@
     @ParameterizedTest(name = "{0}")
     @MethodSource("data")
+    @Disabled("Takes a long time")
     void testImageryEntryValidity(String id, ImageryInfo info) {
         checkEntry(info);
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java	(revision 18870)
@@ -6,10 +6,8 @@
 
 import java.io.File;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
@@ -18,20 +16,14 @@
 import org.openstreetmap.josm.plugins.PluginException;
 import org.openstreetmap.josm.plugins.PluginInformation;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link PluginPreference} class.
  */
+@AssertionsInEDT
+@BasicPreferences
 public class PluginPreferenceTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
-
     /**
      * Unit test of {@link PluginPreference#PluginPreference}.
@@ -60,12 +52,12 @@
         final PluginInformation dummy = getDummyPluginInformation();
         assertEquals("", PluginPreference.buildDownloadSummary(
-                new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.<PluginInformation>emptyList(), "")));
+                new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.emptyList(), "")));
         assertEquals("", PluginPreference.buildDownloadSummary(
-                new PluginDownloadTask(NullProgressMonitor.INSTANCE, Arrays.asList(dummy), "")));
+                new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.singletonList(dummy), "")));
         assertEquals("The following plugin has been downloaded <strong>successfully</strong>:<ul><li>dummy_plugin (31772)</li></ul>"+
                      "Downloading the following plugin has <strong>failed</strong>:<ul><li>dummy_plugin</li></ul>"+
                      "<br>Error message(untranslated): test",
                 PluginPreference.buildDownloadSummary(
-                        new PluginDownloadTask(NullProgressMonitor.INSTANCE, Arrays.asList(dummy), "") {
+                        new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.singletonList(dummy), "") {
                     @Override
                     public Collection<PluginInformation> getFailedPlugins() {
Index: /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java	(revision 18870)
@@ -78,5 +78,5 @@
      */
     @Test
-    void testReadDefaulPresets() throws SAXException, IOException {
+    void testReadDefaultPresets() throws SAXException, IOException {
         String presetfile = "resource://data/defaultpresets.xml";
         final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, true);
Index: /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetValidationTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetValidationTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetValidationTest.java	(revision 18870)
@@ -5,6 +5,5 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import java.util.Arrays;
-import java.util.Locale;
+import java.util.Collections;
 
 import javax.swing.JLabel;
@@ -12,5 +11,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -18,23 +16,15 @@
 import org.openstreetmap.josm.data.osm.Tag;
 import org.openstreetmap.josm.data.validation.OsmValidator;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.I18n;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests for {@code TaggingPresetValidation}
  */
+@Projection
+@I18n
 class TaggingPresetValidationTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rule = new JOSMTestRules().projection();
-
     @BeforeEach
     void setUp() {
-        Locale.setDefault(Locale.ENGLISH);
         OsmValidator.initialize();
     }
@@ -69,5 +59,5 @@
         OsmPrimitive primitive = OsmUtils.createPrimitive("way incline=10m width=1mm opening_hours=\"Mo-Fr 8-10\"");
         new DataSet(primitive);
-        OsmPrimitive clone = TaggingPresetValidation.applyChangedTags(primitive, Arrays.asList(new Tag("incline", "20m")));
+        OsmPrimitive clone = TaggingPresetValidation.applyChangedTags(primitive, Collections.singletonList(new Tag("incline", "20m")));
         assertEquals("20m", clone.get("incline"));
         assertEquals("1mm", clone.get("width"));
Index: /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java	(revision 18870)
@@ -15,8 +15,5 @@
 import javax.swing.JSeparator;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import net.trajano.commons.testing.UtilityClassTestUtil;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
@@ -24,19 +21,14 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MainMenu;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
 import org.openstreetmap.josm.tools.Logging;
+
+import net.trajano.commons.testing.UtilityClassTestUtil;
 
 /**
  * Unit tests of {@link TaggingPresets} class.
  */
+@Main
 public class TaggingPresetsTest {
-
-    /**
-     * Setup rule
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Tests that {@code TaggingPresets} satisfies utility class criteria.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java	(revision 18870)
@@ -7,23 +7,13 @@
 import javax.swing.JPanel;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Unit tests of {@link Check} class.
  */
+@Main
 class CheckTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Unit test for {@link Check#addToPanel}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java	(revision 18870)
@@ -10,24 +10,18 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmUtils;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.I18n;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Unit tests of {@link Combo} class.
  */
+@BasicPreferences
+@I18n("de")
+@Main
 class ComboTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().main().i18n("de");
-
     /**
      * Unit test for {@link Combo#addToPanel}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java	(revision 18870)
@@ -9,8 +9,10 @@
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Unit tests of {@link MultiSelect} class.
  */
+@Main
 class MultiSelectTest {
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java	(revision 18870)
@@ -8,23 +8,13 @@
 import javax.swing.JPanel;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
 
 /**
  * Unit tests of {@link PresetLink} class.
  */
+@TaggingPresets
 class PresetLinkTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rule = new JOSMTestRules().presets();
-
     /**
      * Unit test for {@link PresetLink#addToPanel}.
Index: /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java	(revision 18870)
@@ -7,23 +7,13 @@
 import javax.swing.JPanel;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Main;
 
 /**
  * Unit tests of {@link Text} class.
  */
+@Main
 class TextTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Unit test for {@link Text#addToPanel}.
Index: /trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java	(revision 18870)
@@ -10,7 +10,5 @@
 import java.util.Arrays;
 
-import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -18,18 +16,11 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link GeoJSONWriter} class.
  */
+@Projection
 class GeoJSONWriterTest {
-
-    /**
-     * Setup test.
-     */
-    @BeforeAll
-    public static void setUp() {
-        JOSMFixture.createUnitTestFixture().init();
-    }
-
     /**
      * Unit test for Point
Index: /trunk/test/unit/org/openstreetmap/josm/io/ValidatorErrorWriterTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/ValidatorErrorWriterTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/io/ValidatorErrorWriterTest.java	(revision 18870)
@@ -7,5 +7,4 @@
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -13,5 +12,4 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.Node;
@@ -19,20 +17,11 @@
 import org.openstreetmap.josm.data.validation.TestError;
 import org.openstreetmap.josm.data.validation.tests.RightAngleBuildingTest;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 
 /**
  * Unit tests of {@link ValidatorErrorWriter}
  */
+@BasicPreferences
 class ValidatorErrorWriterTest {
-
-    /**
-     * Setup rule
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences();
-
     @Test
     void testEmpty() throws IOException {
@@ -43,7 +32,7 @@
     void testErrors() throws IOException {
         Locale.setDefault(Locale.ENGLISH);
-        doTest(Arrays.asList(TestError.builder(new RightAngleBuildingTest(), Severity.OTHER, 3701)
-                .message("Building with an almost square angle")
-                .primitives(new Node(LatLon.NORTH_POLE)).build()),
+        doTest(Collections.singletonList(TestError.builder(new RightAngleBuildingTest(), Severity.OTHER, 3701)
+                        .message("Building with an almost square angle")
+                        .primitives(new Node(LatLon.NORTH_POLE)).build()),
                   "  <analyser timestamp='\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3,9}Z' name='Almost right angle buildings'>"
                 + "    <class id='1' level='3'>"
Index: /trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java	(revision 18870)
@@ -12,28 +12,20 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.io.imagery.WMSImagery.WMSGetCapabilitiesException;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 import com.github.tomakehurst.wiremock.WireMockServer;
 import com.github.tomakehurst.wiremock.client.WireMock;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
 /**
  * Unit tests of {@link WMSImagery} class.
  */
+@BasicPreferences(true)
 @BasicWiremock
+@Projection
 class WMSImageryTest {
-
-    /**
-     * Setup test
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    JOSMTestRules test = new JOSMTestRules().projection();
-
     @BasicWiremock
     WireMockServer tileServer;
Index: /trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java	(revision 18870)
@@ -6,5 +6,4 @@
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -12,19 +11,15 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Unit tests of {@link AddNodeHandler} class.
  */
+@AssertionsInEDT
+@Main
+@Projection
 class AddNodeHandlerTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection();
-
     private static AddNodeHandler newHandler(String url) throws RequestHandlerBadRequestException {
         AddNodeHandler req = new AddNodeHandler();
@@ -38,6 +33,7 @@
      */
     @Test
-    void testBadRequestNoLayer() {
-        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?lat=0&lon=0").handle());
+    void testBadRequestNoLayer() throws RequestHandlerBadRequestException {
+        final AddNodeHandler handler = newHandler("https://localhost?lat=0&lon=0");
+        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
         assertEquals("There is no layer opened to add node", e.getMessage());
     }
@@ -47,8 +43,9 @@
      */
     @Test
-    void testBadRequestNoParam() {
+    void testBadRequestNoParam() throws RequestHandlerBadRequestException {
         OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
         MainApplication.getLayerManager().addLayer(layer);
-        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
+        final AddNodeHandler handler = newHandler(null);
+        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
         assertEquals("NumberFormatException (empty String)", e.getMessage());
     }
@@ -58,6 +55,7 @@
      */
     @Test
-    void testBadRequestInvalidUrl() {
-        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
+    void testBadRequestInvalidUrl() throws RequestHandlerBadRequestException {
+        final AddNodeHandler handler = newHandler("invalid_url");
+        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
         assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage());
     }
@@ -67,6 +65,7 @@
      */
     @Test
-    void testBadRequestIncompleteUrl() {
-        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
+    void testBadRequestIncompleteUrl() throws RequestHandlerBadRequestException {
+        final AddNodeHandler handler = newHandler("https://localhost");
+        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
         assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage());
     }
Index: /trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java	(revision 18870)
@@ -2,11 +2,10 @@
 package org.openstreetmap.josm.io.remotecontrol.handler;
 
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.io.File;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
@@ -14,20 +13,12 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
 import org.openstreetmap.josm.tools.Utils;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link ImportHandler} class.
  */
+@Main
 class ImportHandlerTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().main();
-
     private static ImportHandler newHandler(String url) throws RequestHandlerBadRequestException {
         ImportHandler req = new ImportHandler();
@@ -53,6 +44,12 @@
     @Test
     void testBadRequestNoParam() throws Exception {
-        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
-        assertEquals("MalformedURLException: null", e.getMessage());
+        final ImportHandler handler = newHandler(null);
+        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
+        // This has differing behavior after Java 15
+        if ("MalformedURLException: null".length() == e.getMessage().length()) {
+            assertEquals("MalformedURLException: null", e.getMessage());
+        } else {
+            assertEquals("MalformedURLException: Cannot invoke \"String.length()\" because \"spec\" is null", e.getMessage());
+        }
     }
 
@@ -63,5 +60,6 @@
     @Test
     void testBadRequestInvalidUrl() throws Exception {
-        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?url=invalid_url").handle());
+        final ImportHandler handler = newHandler("https://localhost?url=invalid_url");
+        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
         assertEquals("MalformedURLException: no protocol: invalid_url", e.getMessage());
     }
@@ -73,5 +71,6 @@
     @Test
     void testBadRequestIncompleteUrl() throws Exception {
-        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
+        final ImportHandler handler = newHandler("https://localhost?lat=0&lon=0");
+        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
         assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage());
     }
Index: /trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java	(revision 18870)
@@ -24,5 +24,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -42,13 +41,14 @@
 import org.openstreetmap.josm.gui.layer.TMSLayer;
 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 import org.openstreetmap.josm.tools.MultiMap;
 import org.openstreetmap.josm.tools.Utils;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests for Session writing.
  */
+@Main
+@Projection
 public class SessionWriterTest {
 
@@ -96,11 +96,4 @@
         }
     }
-
-    /**
-     * Setup tests.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().projection().main();
 
     /**
Index: /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java	(revision 18870)
@@ -18,8 +18,4 @@
 import java.util.stream.Collectors;
 
-import com.github.tomakehurst.wiremock.client.WireMock;
-import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
-import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -29,10 +25,14 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.PluginServer;
 import org.openstreetmap.josm.testutils.annotations.AssumeRevision;
 import org.openstreetmap.josm.testutils.annotations.FullPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
 import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
 import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker;
+
+import com.github.tomakehurst.wiremock.client.WireMock;
+import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
+import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
 
 /**
@@ -41,12 +41,6 @@
 @AssumeRevision("Revision: 6000\n")
 @FullPreferences
+@Main
 class PluginHandlerJOSMTooOldTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    static JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Plugin server mock.
Index: /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java	(revision 18870)
@@ -17,8 +17,4 @@
 import java.util.stream.Collectors;
 
-import com.github.tomakehurst.wiremock.client.WireMock;
-import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
-import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -28,9 +24,13 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.spi.preferences.Config;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.PluginServer;
 import org.openstreetmap.josm.testutils.annotations.AssumeRevision;
 import org.openstreetmap.josm.testutils.annotations.FullPreferences;
+import org.openstreetmap.josm.testutils.annotations.Main;
 import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
+
+import com.github.tomakehurst.wiremock.client.WireMock;
+import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
+import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
 
 /**
@@ -38,12 +38,6 @@
  */
 @FullPreferences
+@Main
 class PluginHandlerMultiVersionTest {
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    static JOSMTestRules test = new JOSMTestRules().main();
-
     /**
      * Plugin server mock.
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 18870)
@@ -24,9 +24,10 @@
 import java.util.Map;
 import java.util.TimeZone;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.Handler;
 import java.util.logging.Level;
 
-import mockit.internal.state.SavePoint;
 import org.awaitility.Awaitility;
+import org.awaitility.Durations;
 import org.junit.jupiter.api.extension.AfterAllCallback;
 import org.junit.jupiter.api.extension.AfterEachCallback;
@@ -54,8 +55,6 @@
 import org.openstreetmap.josm.data.projection.Projections;
 import org.openstreetmap.josm.gui.MainApplication;
-import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
 import org.openstreetmap.josm.gui.oauth.OAuthAuthorizationWizard;
 import org.openstreetmap.josm.gui.preferences.imagery.ImageryPreferenceTestIT;
-import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
 import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.io.CertificateAmendment;
@@ -66,4 +65,8 @@
 import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.spi.preferences.Setting;
+import org.openstreetmap.josm.testutils.annotations.JosmDefaults;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
+import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
+import org.openstreetmap.josm.testutils.annotations.Territories;
 import org.openstreetmap.josm.testutils.mockers.EDTAssertionMocker;
 import org.openstreetmap.josm.testutils.mockers.WindowlessMapViewStateMocker;
@@ -76,5 +79,4 @@
 import org.openstreetmap.josm.tools.MemoryManagerTest;
 import org.openstreetmap.josm.tools.PlatformManager;
-import org.openstreetmap.josm.tools.Territories;
 import org.openstreetmap.josm.tools.Utils;
 import org.openstreetmap.josm.tools.bugreport.ReportedException;
@@ -82,4 +84,5 @@
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import mockit.internal.state.SavePoint;
 
 /**
@@ -591,14 +594,14 @@
         if (useMapStyles) {
             // Reset the map paint styles.
-            MapPaintStyles.readFromPreferences();
+            MapPaintStyles.MapPaintStylesExtension.setup();
         }
 
         if (usePresets) {
             // Reset the presets.
-            TaggingPresets.readFromPreferences();
+            TaggingPresets.TaggingPresetsExtension.setup();
         }
 
         if (territories) {
-            Territories.initializeInternalData();
+            Territories.TerritoriesExtension.setup(Territories.Initialize.INTERNAL);
         }
 
@@ -632,4 +635,5 @@
 
     private void workaroundJdkBug8159956() {
+        // Note: This has been backported to Java 8u381 (2023-07-18)
         try {
             if (PlatformManager.isPlatformWindows() && Utils.getJavaVersion() == 8 && GraphicsEnvironment.isHeadless()) {
@@ -652,5 +656,5 @@
         cleanLayerEnvironment();
         Preferences.main().resetToInitialState();
-        System.gc();
+        JosmDefaults.DefaultsExtension.memoryCleanup();
     }
 
@@ -689,5 +693,6 @@
         final boolean[] queueEmpty = {false};
         MainApplication.worker.submit(() -> queueEmpty[0] = true);
-        Awaitility.await().forever().until(() -> queueEmpty[0]);
+        // Default pollInterval is 100ms, which means that each test takes (at minimum) .1s.
+        Awaitility.await().pollDelay(0, TimeUnit.SECONDS).pollInterval(Durations.ONE_MILLISECOND).forever().until(() -> queueEmpty[0]);
         // Remove all layers
         cleanLayerEnvironment();
@@ -718,5 +723,5 @@
 
         // Parts of JOSM uses weak references - destroy them.
-        System.gc();
+        JosmDefaults.DefaultsExtension.memoryCleanup();
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/BasicPreferences.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/BasicPreferences.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/BasicPreferences.java	(revision 18870)
@@ -28,5 +28,10 @@
 /**
  * Allow tests to use JOSM preferences (see {@link JOSMTestRules#preferences()}).
- * This is often enough for basic tests.
+ * This is often enough for basic tests. There are two modes:
+ * <ul>
+ *     <li>Between test classes (usually enough) if annotated at the class level ({@link ElementType#TYPE})</li>
+ *     <li>Between test methods if annotated at the method level ({@link ElementType#METHOD})</li>
+ *     <li>Between test method if annotated at the class level <i>and</i> the annotated value is {@code true}</li>
+ * </ul>
  *
  * @author Taylor Smock
@@ -40,4 +45,9 @@
 @ExtendWith(BasicPreferences.BasicPreferencesExtension.class)
 public @interface BasicPreferences {
+    /**
+     * Clear preferences between tests
+     * @return {@code true} if the preferences should be cleared between tests
+     */
+    boolean value() default false;
 
     /**
@@ -80,5 +90,6 @@
         @Override
         public void beforeEach(ExtensionContext context) throws Exception {
-            if (AnnotationSupport.isAnnotated(context.getElement(), BasicPreferences.class) || Config.getPref() == null) {
+            if (AnnotationSupport.isAnnotated(context.getElement(), BasicPreferences.class) || Config.getPref() == null
+            || AnnotationUtils.findFirstParentAnnotation(context, BasicPreferences.class).map(BasicPreferences::value).orElse(false)) {
                 this.beforeAll(context);
             }
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/I18n.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/I18n.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/I18n.java	(revision 18870)
@@ -4,4 +4,5 @@
 import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -13,5 +14,4 @@
 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.tools.LanguageInfo;
 
@@ -23,4 +23,5 @@
  */
 @Documented
+@Inherited
 @Retention(RetentionPolicy.RUNTIME)
 @Target({ElementType.TYPE, ElementType.METHOD})
@@ -42,5 +43,5 @@
         @Override
         public void beforeEach(ExtensionContext context) {
-            String language = AnnotationSupport.findAnnotation(context.getElement(), I18n.class).map(I18n::value).orElse("en");
+            String language = AnnotationUtils.findFirstParentAnnotation(context, I18n.class).map(I18n::value).orElse("en");
             if (!Locale.getDefault().equals(LanguageInfo.getLocale(language, false))) {
                 org.openstreetmap.josm.tools.I18n.set(language);
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java	(revision 18870)
@@ -10,5 +10,7 @@
 import java.util.Arrays;
 
+import org.junit.jupiter.api.extension.AfterAllCallback;
 import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
 import org.junit.jupiter.api.extension.BeforeEachCallback;
 import org.junit.jupiter.api.extension.ExtendWith;
@@ -25,4 +27,5 @@
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.MemoryManagerTest;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -38,8 +41,16 @@
      * Functionality that this provides may be moved to other classes.
      */
-    class DefaultsExtension implements BeforeEachCallback, AfterEachCallback {
+    class DefaultsExtension implements BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback {
+        private static final boolean PERFORM_MEMORY_CLEANUP =
+                !Boolean.parseBoolean(System.getProperty("test.without.gc", Boolean.FALSE.toString()));
+        private static final int JAVA_VERSION = Utils.getJavaVersion();
+
+        @Override
+        public void beforeAll(ExtensionContext extensionContext) throws Exception {
+            cleanUpFromJosmFixture();
+        }
+
         @Override
         public void beforeEach(ExtensionContext context) throws Exception {
-            cleanUpFromJosmFixture();
             // Assume anonymous user
             if (!UserIdentityManager.getInstance().isAnonymous()) {
@@ -70,7 +81,10 @@
                 }
             });
+        }
 
+        @Override
+        public void afterAll(ExtensionContext extensionContext) throws Exception {
             // Parts of JOSM uses weak references - destroy them.
-            System.gc();
+            memoryCleanup();
         }
 
@@ -84,5 +98,23 @@
             Preferences.main().resetToInitialState();
             Preferences.main().enableSaveOnPut(false);
-            System.gc();
+            memoryCleanup();
+        }
+
+        /**
+         * Call {@link System#gc()}
+         * Warning: This is a very expensive method! GC is expensive!
+         * For reference, a test run without gc will take ~7 minutes.
+         * A test run with gc will take 20 minutes (if run before/after each test method) or 10 minutes (if run before/after each test class).
+         * <p>
+         * If you want to do a test run without manual calls to gc, add `-Dtest.without.gc=true` to the arguments.
+         */
+        public static void memoryCleanup() {
+            if (PERFORM_MEMORY_CLEANUP) {
+                System.gc();
+                // Finalization was deprecated in Java 18
+                if (JAVA_VERSION <= 17) {
+                    System.runFinalization();
+                }
+            }
         }
     }
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/MapPaintStyles.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/MapPaintStyles.java	(revision 18870)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/MapPaintStyles.java	(revision 18870)
@@ -0,0 +1,44 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.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 org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.openstreetmap.josm.gui.mappaint.ElemStyles;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+/**
+ * Use map styles in tests.
+ *
+ * @author Taylor Smock
+ * @see JOSMTestRules#mapStyles()
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.METHOD, ElementType.TYPE })
+@BasicPreferences
+@ExtendWith(MapPaintStyles.MapPaintStylesExtension.class)
+public @interface MapPaintStyles {
+    class MapPaintStylesExtension implements BeforeEachCallback {
+        private static int lastHashcode;
+
+        @Override
+        public void beforeEach(ExtensionContext extensionContext) throws Exception {
+            setup();
+        }
+
+        public static void setup() {
+            final ElemStyles styles = org.openstreetmap.josm.gui.mappaint.MapPaintStyles.getStyles();
+            if (styles.getStyleSources().hashCode() != lastHashcode || styles.getStyleSources().isEmpty()) {
+                org.openstreetmap.josm.gui.mappaint.MapPaintStyles.readFromPreferences();
+                lastHashcode = org.openstreetmap.josm.gui.mappaint.MapPaintStyles.getStyles().getStyleSources().hashCode();
+            }
+        }
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/ProjectionNadGrids.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/ProjectionNadGrids.java	(revision 18870)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/ProjectionNadGrids.java	(revision 18870)
@@ -0,0 +1,39 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.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.nio.file.Paths;
+
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.tools.Utils;
+
+/**
+ * Use NAD projections in tests.
+ *
+ * @author Taylor Smock
+ * @see JOSMTestRules#projectionNadGrids()
+ *
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.METHOD, ElementType.TYPE })
+@ExtendWith(ProjectionNadGrids.NadGridsExtension.class)
+public @interface ProjectionNadGrids {
+    class NadGridsExtension implements BeforeEachCallback {
+        @Override
+        public void beforeEach(ExtensionContext extensionContext) throws Exception {
+            if (Utils.isBlank(Utils.getSystemProperty("PROJ_LIB"))) {
+                Utils.updateSystemProperty("PROJ_LIB", Paths.get("nodist", "data", "projection").toString());
+            }
+            MainApplication.setupNadGridSources();
+        }
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/ResetUniquePrimitiveIdCounters.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/ResetUniquePrimitiveIdCounters.java	(revision 18870)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/ResetUniquePrimitiveIdCounters.java	(revision 18870)
@@ -0,0 +1,68 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.testutils.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.platform.commons.function.Try;
+import org.junit.platform.commons.support.ReflectionSupport;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.UniqueIdGenerator;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.spi.preferences.Config;
+import org.openstreetmap.josm.spi.preferences.MemoryPreferences;
+
+/**
+ * Reset {@link org.openstreetmap.josm.data.osm.OsmPrimitive} id counters for tests where it makes a difference.
+ * This is most likely an ordering issue with a {@link java.util.Set} collection.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+@BasicPreferences
+@ExtendWith(ResetUniquePrimitiveIdCounters.Reset.class)
+public @interface ResetUniquePrimitiveIdCounters {
+    class Reset implements BeforeEachCallback {
+        private static AtomicLong[] ID_COUNTERS;
+
+        @Override
+        public void beforeEach(ExtensionContext extensionContext) throws Exception {
+            if (ID_COUNTERS == null) {
+                ID_COUNTERS = getIdCounters();
+            }
+
+            for (AtomicLong counter : ID_COUNTERS) {
+                counter.set(0);
+            }
+        }
+
+        private static AtomicLong[] getIdCounters() throws ReflectiveOperationException {
+            Config.setPreferencesInstance(new MemoryPreferences());
+            List<AtomicLong> idCounters = new ArrayList<>(3);
+            final Field idCounter = UniqueIdGenerator.class.getDeclaredField("idCounter");
+            for (Try<Object> primitive : Arrays.asList(
+                    ReflectionSupport.tryToReadFieldValue(Node.class.getDeclaredField("idGenerator"), null),
+                    ReflectionSupport.tryToReadFieldValue(Way.class.getDeclaredField("idGenerator"), null),
+                    ReflectionSupport.tryToReadFieldValue(Relation.class.getDeclaredField("idGenerator"), null)
+            )) {
+                primitive.andThen(generator -> ReflectionSupport.tryToReadFieldValue(idCounter, generator))
+                        .ifSuccess(counter -> idCounters.add((AtomicLong) counter));
+            }
+            return idCounters.toArray(new AtomicLong[0]);
+        }
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/Territories.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/Territories.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/annotations/Territories.java	(revision 18870)
@@ -4,4 +4,5 @@
 import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -28,4 +29,5 @@
 @BasicPreferences // Needed for nodes
 @Projection // Needed for getEastNorth
+@Inherited
 @ExtendWith(Territories.TerritoriesExtension.class)
 public @interface Territories {
@@ -63,25 +65,33 @@
 
         @Override
-        public void beforeAll(ExtensionContext context) throws Exception {
+        public void beforeAll(ExtensionContext context) {
             this.beforeEach(context);
         }
 
         @Override
-        public void beforeEach(ExtensionContext context) throws Exception {
+        public void beforeEach(ExtensionContext context) {
             Optional<Territories> 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();
-                    }
+                setup(current);
+            }
+        }
+
+        /**
+         * Set up the test
+         * @param current The current level to initialize {@link org.openstreetmap.josm.tools.Territories} to
+         */
+        public static void setup(Initialize current) {
+            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();
                 }
             }
Index: /trunk/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java	(revision 18870)
@@ -13,5 +13,4 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.openstreetmap.josm.io.ChangesetClosedException;
 import org.openstreetmap.josm.io.IllegalDataException;
@@ -22,22 +21,14 @@
 import org.openstreetmap.josm.io.OsmApiInitializationException;
 import org.openstreetmap.josm.io.auth.CredentialsManager;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.tools.date.DateUtils;
 import org.openstreetmap.josm.tools.date.DateUtilsTest;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link ExceptionUtil} class.
  */
+@BasicPreferences
+@org.openstreetmap.josm.testutils.annotations.OsmApi(org.openstreetmap.josm.testutils.annotations.OsmApi.APIType.FAKE)
 class ExceptionUtilTest {
-
-    /**
-     * Setup rule.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
-
     private static String baseUrl;
     private static String serverUrl;
Index: /trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java	(revision 18870)
@@ -10,22 +10,12 @@
 import java.util.stream.Stream;
 
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.Test;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.I18n;
 
 /**
  * Unit tests of {@link LanguageInfo}.
  */
+@I18n("ca@valencia")
 class LanguageInfoTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().i18n("ca@valencia");
-
     private static final Locale EN_NZ = new Locale("en", "NZ");
     private static final Locale DE_DE = Locale.GERMANY;
Index: /trunk/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java	(revision 18870)
@@ -11,37 +11,18 @@
 import javax.swing.ImageIcon;
 
-import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmUtils;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetsTest;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
 import org.openstreetmap.josm.tools.OsmPrimitiveImageProvider.Options;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
  * Unit tests of {@link OsmPrimitiveImageProvider}
  */
+@MapPaintStyles
+@org.openstreetmap.josm.testutils.annotations.TaggingPresets
 class OsmPrimitiveImageProviderTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().mapStyles().presets();
-
-    /**
-     * Setup test.
-     */
-    @BeforeAll
-    public static void setUp() {
-        JOSMFixture.createUnitTestFixture().init();
-    }
-
     /**
      * Unit test of {@link OsmPrimitiveImageProvider#getResource}.
Index: /trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java	(revision 18870)
@@ -8,22 +8,11 @@
 
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.openstreetmap.josm.testutils.annotations.Projection;
 
 /**
  * Integration tests of {@link Territories} class.
  */
+@Projection
 class TerritoriesTestIT {
-
-    /**
-     * Test rules.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules rules = new JOSMTestRules().projection();
-
-
     /**
      * Test of {@link Territories#initialize} method.
Index: /trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java	(revision 18870)
@@ -17,28 +17,20 @@
 import java.util.concurrent.ForkJoinPool;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import net.trajano.commons.testing.UtilityClassTestUtil;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
+import org.openstreetmap.josm.testutils.annotations.I18n;
 import org.openstreetmap.josm.tools.UncheckedParseException;
+
+import net.trajano.commons.testing.UtilityClassTestUtil;
 
 /**
  * Unit tests of {@link DateUtils} class.
  */
+@BasicPreferences
+@I18n
 public class DateUtilsTest {
-
-    /**
-     * Set the timezone and timeout.
-     * <p>
-     * Timeouts need to be disabled because we change the time zone.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().i18n().preferences();
-
     /**
      * Tests that {@code DateUtils} satisfies utility class criteria.
Index: /trunk/test/unit/org/openstreetmap/josm/tools/date/IntervalTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/date/IntervalTest.java	(revision 18869)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/date/IntervalTest.java	(revision 18870)
@@ -2,24 +2,15 @@
 package org.openstreetmap.josm.tools.date;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-import org.openstreetmap.josm.testutils.JOSMTestRules;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.time.Instant;
 import java.util.Locale;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 
+@BasicPreferences
 class IntervalTest {
-
-    /**
-     * Setup test.
-     */
-    @RegisterExtension
-    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences();
-
     /**
      * Setup test.
