Ignore:
Timestamp:
2023-10-16T15:19:07+02:00 (13 months ago)
Author:
taylor.smock
Message:

See #16567: Update to JUnit 5

This converts most tests to use @Annotations. There are also some performance
improvements as it relates to tests.

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
3 added
150 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java

    r17275 r18870  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.jupiter.api.Assertions.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    55
    6 import org.junit.jupiter.api.extension.RegisterExtension;
    76import org.junit.jupiter.api.Test;
    8 import org.openstreetmap.josm.testutils.JOSMTestRules;
     7import org.openstreetmap.josm.testutils.annotations.Main;
    98
    10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    119
    1210/**
    1311 * Unit tests for class {@link AboutAction}.
    1412 */
     13@Main
    1514final class AboutActionTest {
    16 
    17     /**
    18      * Setup test.
    19      */
    20     @RegisterExtension
    21     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules().main();
    23 
    2415    /**
    2516     * Unit test of {@link AboutAction#buildAboutPanel}.
     
    2718    @Test
    2819    void testBuildAboutPanel() {
    29         assertNotNull(new AboutAction().buildAboutPanel());
     20        assertDoesNotThrow(() -> new AboutAction().buildAboutPanel());
    3021    }
    3122}
  • trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java

    r18630 r18870  
    1111
    1212import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.extension.RegisterExtension;
    1413import org.openstreetmap.gui.jmapviewer.FeatureAdapter;
    1514import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    1716import org.openstreetmap.josm.gui.layer.TMSLayer;
    1817import org.openstreetmap.josm.gui.layer.WMSLayer;
    19 import org.openstreetmap.josm.testutils.JOSMTestRules;
    2018import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2119import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
     20import org.openstreetmap.josm.testutils.annotations.OsmApi;
     21import org.openstreetmap.josm.testutils.annotations.Projection;
    2222
    2323import com.github.tomakehurst.wiremock.WireMockServer;
    24 
    25 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2624
    2725/**
    2826 * Unit tests for class {@link AddImageryLayerAction}.
    2927 */
     28@BasicPreferences
    3029@BasicWiremock
    31 @BasicPreferences
     30@OsmApi(OsmApi.APIType.FAKE)
     31@Projection
    3232final class AddImageryLayerActionTest {
    33     /**
    34      * We need prefs for this. We need platform for actions and the OSM API for checking blacklist.
    35      */
    36     @RegisterExtension
    37     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    38     public JOSMTestRules test = new JOSMTestRules().fakeAPI().projection();
    39 
    4033    /**
    4134     * HTTP mock.
  • trunk/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java

    r18615 r18870  
    1818
    1919import org.junit.jupiter.api.Test;
    20 import org.junit.jupiter.api.extension.RegisterExtension;
    2120import org.openstreetmap.josm.TestUtils;
    2221import org.openstreetmap.josm.actions.AlignInCircleAction.InvalidSelection;
     
    3029import org.openstreetmap.josm.io.IllegalDataException;
    3130import org.openstreetmap.josm.io.OsmReader;
    32 import org.openstreetmap.josm.testutils.JOSMTestRules;
     31import org.openstreetmap.josm.testutils.annotations.Projection;
    3332import org.opentest4j.AssertionFailedError;
    34 
    35 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3633
    3734/**
    3835 * Unit tests for class {@link AlignInLineAction}.
    3936 */
     37@Projection
    4038final class AlignInCircleActionTest {
    41 
    42     /**
    43      * Setup test.
    44      */
    45     @RegisterExtension
    46     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    47     public JOSMTestRules test = new JOSMTestRules().projection();
    48 
    49 
    5039    /**
    5140     * Test case: way with several nodes selected
     
    6554        }
    6655        assertNotNull(roundabout);
    67         if (roundabout != null) {
    68             ds.setSelected(roundabout);
    69             Command c = AlignInCircleAction.buildCommand(ds);
    70             c.executeCommand();
    71             Way expected = (Way) ds2.getPrimitiveById(roundabout);
    72             assertNotNull(expected);
    73             assertEquals(expected, roundabout);
    74             assertEquals(expected.getNodesCount(), roundabout.getNodesCount());
    75             for (Node n1 : roundabout.getNodes()) {
    76                 Node n2 = (Node) ds2.getPrimitiveById(n1);
    77                 assertEquals(n1.lat(), n2.lat(), 1e-5);
    78                 assertEquals(n1.lon(), n2.lon(), 1e-5);
    79             }
     56        ds.setSelected(roundabout);
     57        Command c = AlignInCircleAction.buildCommand(ds);
     58        c.executeCommand();
     59        Way expected = (Way) ds2.getPrimitiveById(roundabout);
     60        assertNotNull(expected);
     61        assertEquals(expected, roundabout);
     62        assertEquals(expected.getNodesCount(), roundabout.getNodesCount());
     63        for (Node n1 : roundabout.getNodes()) {
     64            Node n2 = (Node) ds2.getPrimitiveById(n1);
     65            assertEquals(n1.lat(), n2.lat(), 1e-5);
     66            assertEquals(n1.lon(), n2.lon(), 1e-5);
    8067        }
    8168    }
     
    9885        }
    9986        assertNotNull(roundabout);
    100         if (roundabout != null) {
    101             ds.setSelected(roundabout);
    102             assertNull(AlignInCircleAction.buildCommand(ds));
    103         }
     87        ds.setSelected(roundabout);
     88        assertNull(AlignInCircleAction.buildCommand(ds));
    10489    }
    10590
     
    121106        }
    122107        assertNotNull(circularWay);
    123         if (circularWay != null) {
    124             ds.setSelected(circularWay.getNodes());
    125             Command c = AlignInCircleAction.buildCommand(ds);
    126             assertNotNull(c);
    127             c.executeCommand();
    128             Way expected = (Way) ds2.getPrimitiveById(circularWay);
    129             assertNotNull(expected);
    130             assertEquals(expected, circularWay);
    131             assertEquals(expected.getNodesCount(), circularWay.getNodesCount());
    132             for (Node n1 : circularWay.getNodes()) {
    133                 Node n2 = (Node) ds2.getPrimitiveById(n1);
    134                 assertEquals(n1.lat(), n2.lat(), 1e-5);
    135                 assertEquals(n1.lon(), n2.lon(), 1e-5);
    136             }
     108        ds.setSelected(circularWay.getNodes());
     109        Command c = AlignInCircleAction.buildCommand(ds);
     110        assertNotNull(c);
     111        c.executeCommand();
     112        Way expected = (Way) ds2.getPrimitiveById(circularWay);
     113        assertNotNull(expected);
     114        assertEquals(expected, circularWay);
     115        assertEquals(expected.getNodesCount(), circularWay.getNodesCount());
     116        for (Node n1 : circularWay.getNodes()) {
     117            Node n2 = (Node) ds2.getPrimitiveById(n1);
     118            assertEquals(n1.lat(), n2.lat(), 1e-5);
     119            assertEquals(n1.lon(), n2.lon(), 1e-5);
    137120        }
    138121    }
  • trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java

    r17275 r18870  
    22package org.openstreetmap.josm.actions;
    33
     4import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    45import static org.junit.jupiter.api.Assertions.assertEquals;
    5 import static org.junit.jupiter.api.Assertions.assertNotNull;
    66import static org.junit.jupiter.api.Assertions.assertNull;
    77import static org.junit.jupiter.api.Assertions.assertThrows;
     
    99import org.junit.jupiter.api.BeforeEach;
    1010import org.junit.jupiter.api.Test;
    11 import org.junit.jupiter.api.extension.RegisterExtension;
    1211import org.openstreetmap.josm.actions.AlignInLineAction.InvalidSelection;
    1312import org.openstreetmap.josm.actions.AlignInLineAction.Line;
     
    1817import org.openstreetmap.josm.data.osm.Way;
    1918import org.openstreetmap.josm.gui.MainApplication;
    20 import org.openstreetmap.josm.testutils.JOSMTestRules;
    21 
    22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     19import org.openstreetmap.josm.testutils.annotations.Main;
     20import org.openstreetmap.josm.testutils.annotations.Projection;
    2321
    2422/**
    2523 * Unit tests for class {@link AlignInLineAction}.
    2624 */
     25@Main
     26@Projection
    2727final class AlignInLineActionTest {
    28 
    29     /**
    30      * Setup test.
    31      */
    32     @RegisterExtension
    33     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    34     public JOSMTestRules test = new JOSMTestRules().main().projection();
    35 
    3628    /** Class under test. */
    3729    private static AlignInLineAction action;
     
    5042     * Test case: only nodes selected, part of an open way: align these nodes on the line passing through the extremity
    5143     * nodes (the most distant in the way sequence, not the most euclidean-distant). See
    52      * https://josm.openstreetmap.de/ticket/9605#comment:3. Note that in this test, after alignment, way is overlapping
    53      * itself.
     44     * <a href="https://josm.openstreetmap.de/ticket/9605#comment:3">comment:3:ticket:9605</a>.
     45     * Note that in this test, after alignment, way is overlapping itself.
    5446     * @throws InvalidSelection never
    5547     */
     
    211203    @Test
    212204    void testLineDifferentCoordinates() throws InvalidSelection {
    213         assertNotNull(new Line(new Node(new EastNorth(0, 1)),
     205        assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)),
    214206                               new Node(new EastNorth(0, 2))));
    215         assertNotNull(new Line(new Node(new EastNorth(0, 1)),
     207        assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)),
    216208                               new Node(new EastNorth(1, 1))));
    217         assertNotNull(new Line(new Node(new EastNorth(0, 1)),
     209        assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)),
    218210                               new Node(new EastNorth(0+1e-150, 1+1e-150))));
    219211    }
  • trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java

    r18853 r18870  
    2323import org.openstreetmap.josm.io.IllegalDataException;
    2424import org.openstreetmap.josm.io.OsmReader;
     25import org.openstreetmap.josm.testutils.annotations.ResetUniquePrimitiveIdCounters;
    2526
    2627import nl.jqno.equalsverifier.EqualsVerifier;
     
    114115     */
    115116    @Test
     117    @ResetUniquePrimitiveIdCounters
    116118    void testTicket18367NeedsSplit() throws IOException, IllegalDataException {
    117119        try (InputStream is = TestUtils.getRegressionDataStream(18367, "split-and-reverse.osm")) {
  • trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java

    r18690 r18870  
    1717
    1818import org.junit.jupiter.api.Test;
    19 import org.junit.jupiter.api.extension.RegisterExtension;
    2019import org.openstreetmap.josm.data.coor.LatLon;
    2120import org.openstreetmap.josm.data.osm.DataSet;
     
    2625import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
    2726import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    28 import org.openstreetmap.josm.testutils.JOSMTestRules;
    29 
    30 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     27import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     28import org.openstreetmap.josm.testutils.annotations.Main;
     29import org.openstreetmap.josm.testutils.annotations.OsmApi;
     30import org.openstreetmap.josm.testutils.annotations.Projection;
    3131
    3232/**
    3333 * Unit tests for class {@link CopyAction}.
    3434 */
     35@BasicPreferences
     36@Main
     37@OsmApi(OsmApi.APIType.FAKE)
     38@Projection
    3539class CopyActionTest {
    3640    private static final class CapturingCopyAction extends CopyAction {
     
    4246        }
    4347    }
    44 
    45     /**
    46      * We need prefs for this.
    47      */
    48     @RegisterExtension
    49     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    50     public static JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI().main().projection();
    5148
    5249    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java

    r17333 r18870  
    1010
    1111import org.junit.jupiter.api.Test;
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1312import org.openstreetmap.josm.data.coor.EastNorth;
    1413import org.openstreetmap.josm.data.coor.LatLon;
     
    1716import org.openstreetmap.josm.data.osm.Node;
    1817import org.openstreetmap.josm.data.osm.Way;
    19 import org.openstreetmap.josm.testutils.JOSMTestRules;
     18import org.openstreetmap.josm.testutils.annotations.Projection;
    2019import org.openstreetmap.josm.tools.GeoProperty;
    2120import org.openstreetmap.josm.tools.GeoPropertyIndex;
     
    2423import org.openstreetmap.josm.tools.RightAndLefthandTraffic;
    2524
    26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    27 
    2825/**
    2926 * Unit tests for class {@link CreateCircleAction}.
    3027 */
     28@Projection
    3129final class CreateCircleActionTest {
    32 
    33     /**
    34      * Setup test.
    35      */
    36     @RegisterExtension
    37     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    38     public JOSMTestRules test = new JOSMTestRules().projection();
    39 
    4030    /**
    4131     * Test case: When Create Circle action is performed with a single way selected,
    4232     * circle direction must equals way direction.
    4333     * see #7421
    44      * @throws ReflectiveOperationException if an error occurs
    4534     */
    4635    @Test
    47     void testTicket7421case0() throws ReflectiveOperationException {
     36    void testTicket7421case0() {
    4837        DataSet dataSet = new DataSet();
    4938
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java

    r17429 r18870  
    1515
    1616import org.junit.jupiter.api.Test;
    17 import org.junit.jupiter.api.extension.RegisterExtension;
    1817import org.openstreetmap.josm.TestUtils;
    1918import org.openstreetmap.josm.command.SequenceCommand;
     
    3029import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3130import org.openstreetmap.josm.io.OsmReader;
    32 import org.openstreetmap.josm.testutils.JOSMTestRules;
     31import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     32import org.openstreetmap.josm.testutils.annotations.Main;
     33import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
     34import org.openstreetmap.josm.testutils.annotations.Projection;
    3335import org.openstreetmap.josm.tools.Pair;
    3436import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    35 
    36 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3737
    3838/**
    3939 * Unit test of {@link CreateMultipolygonAction}
    4040 */
     41@BasicPreferences
     42@Main
     43@MapPaintStyles
     44@Projection
    4145class CreateMultipolygonActionTest {
    42 
    43     /**
    44      * Setup test.
    45      */
    46     @RegisterExtension
    47     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    48     public JOSMTestRules test = new JOSMTestRules().projection().main().preferences().mapStyles();
    49 
    5046    private static Map<String, String> getRefToRoleMap(Relation relation) {
    5147        Map<String, String> refToRole = new TreeMap<>();
  • trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java

    r18350 r18870  
    99import org.junit.jupiter.api.BeforeAll;
    1010import org.junit.jupiter.api.Test;
    11 import org.junit.jupiter.api.extension.RegisterExtension;
    1211import org.openstreetmap.josm.TestUtils;
    1312import org.openstreetmap.josm.data.cache.JCSCacheManager;
     
    1514import org.openstreetmap.josm.gui.io.SaveLayersDialog;
    1615import org.openstreetmap.josm.gui.progress.swing.ProgressMonitorExecutor;
    17 import org.openstreetmap.josm.testutils.JOSMTestRules;
     16import org.openstreetmap.josm.testutils.annotations.Main;
    1817import org.openstreetmap.josm.tools.ImageProvider;
    1918import org.openstreetmap.josm.tools.Utils;
    2019
    2120import com.ginsberg.junit.exit.ExpectSystemExitWithStatus;
    22 
    23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2421import mockit.Invocation;
    2522import mockit.Mock;
     
    2926 * Unit tests for class {@link ExitAction}.
    3027 */
     28@Main
    3129final class ExitActionTest {
    32 
    33     /**
    34      * Setup test.
    35      */
    36     @RegisterExtension
    37     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    38     public JOSMTestRules test = new JOSMTestRules().main();
    39 
    4030    @BeforeAll
    4131    static void beforeAll() {
  • trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java

    r17275 r18870  
    22package org.openstreetmap.josm.actions;
    33
    4 import org.junit.jupiter.api.extension.RegisterExtension;
    54import org.junit.jupiter.api.Test;
    6 import org.openstreetmap.josm.testutils.JOSMTestRules;
    7 
    8 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     5import org.openstreetmap.josm.testutils.annotations.Main;
    96
    107/**
    118 * Test {@link FullscreenToggleAction}
    129 */
     10@Main
    1311class FullscreenToggleActionTest {
    14     /**
    15      * Setup test.
    16      */
    17     @RegisterExtension
    18     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    19     public JOSMTestRules test = new JOSMTestRules().main();
    20 
    2112    /**
    2213     * Test {@link FullscreenToggleAction}
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r18690 r18870  
    1717
    1818import org.junit.jupiter.api.Test;
    19 import org.junit.jupiter.api.extension.RegisterExtension;
    2019import org.openstreetmap.josm.TestUtils;
    2120import org.openstreetmap.josm.actions.search.SearchAction;
     
    3635import org.openstreetmap.josm.io.IllegalDataException;
    3736import org.openstreetmap.josm.io.OsmReader;
    38 import org.openstreetmap.josm.testutils.JOSMTestRules;
     37import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     38import org.openstreetmap.josm.testutils.annotations.Main;
     39import org.openstreetmap.josm.testutils.annotations.Projection;
    3940import org.openstreetmap.josm.tools.MultiMap;
    4041import org.openstreetmap.josm.tools.Utils;
    41 
    42 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    4342
    4443/**
    4544 * Unit tests of {@link JoinAreasAction} class.
    4645 */
     46@BasicPreferences
     47@Main
     48@Projection
    4749class JoinAreasActionTest {
    48 
    49     /**
    50      * Setup test.
    51      */
    52     @RegisterExtension
    53     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    54     public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
    55 
    5650    /**
    5751     * Non-regression test for bug #9599.
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java

    r17275 r18870  
    1313
    1414import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    1615import org.openstreetmap.josm.TestUtils;
    1716import org.openstreetmap.josm.data.coor.EastNorth;
     
    2726import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2827import org.openstreetmap.josm.io.OsmReader;
    29 import org.openstreetmap.josm.testutils.JOSMTestRules;
     28import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     29import org.openstreetmap.josm.testutils.annotations.Main;
     30import org.openstreetmap.josm.testutils.annotations.Projection;
    3031import org.openstreetmap.josm.tools.Geometry;
    31 
    32 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3332
    3433/**
    3534 * Unit tests for class {@link JoinNodeWayAction}.
    3635 */
     36@BasicPreferences
     37@Main
     38@Projection
    3739final class JoinNodeWayActionTest {
    38     /**
    39      * Setup test.
    40      */
    41     @RegisterExtension
    42     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    43     public JOSMTestRules test = new JOSMTestRules().projection().main().preferences();
    44 
    4540    private void setupMapView(DataSet ds) {
    4641        // setup a reasonable size for the edit window
     
    6055     * Test case: Move node onto two almost overlapping ways
    6156     * see #18189 moveontoway.osm
    62      * @throws Exception if an error occurs
    63      */
    64     @Test
    65     void testTicket18189() throws Exception {
     57     */
     58    @Test
     59    void testTicket18189() {
    6660        DataSet dataSet = new DataSet();
    6761        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java

    r17275 r18870  
    1212import org.junit.jupiter.api.BeforeEach;
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.TestUtils;
    1615import org.openstreetmap.josm.data.osm.DataSet;
     
    2019import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2120import org.openstreetmap.josm.gui.widgets.JosmComboBox;
    22 import org.openstreetmap.josm.testutils.JOSMTestRules;
     21import org.openstreetmap.josm.testutils.annotations.Main;
     22import org.openstreetmap.josm.testutils.annotations.Projection;
    2323import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
    2424import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    25 
    26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2725
    2826/**
    2927 * Unit tests for class {@link MergeLayerAction}.
    3028 */
     29@Main
     30@Projection
    3131public class MergeLayerActionTest {
    32 
    33     /**
    34      * Setup test.
    35      */
    36     @RegisterExtension
    37     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    38     public JOSMTestRules test = new JOSMTestRules().main().projection();
    39 
    4032    /**
    4133     * MergeLayerExtendedDialog mocker.
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java

    r17275 r18870  
    88import java.util.Arrays;
    99import java.util.Collections;
     10import java.util.List;
    1011
    1112import org.junit.jupiter.api.Test;
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.data.coor.LatLon;
    1414import org.openstreetmap.josm.data.osm.DataSet;
    1515import org.openstreetmap.josm.data.osm.Node;
    1616import org.openstreetmap.josm.spi.preferences.Config;
    17 import org.openstreetmap.josm.testutils.JOSMTestRules;
    18 
    19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     17import org.openstreetmap.josm.testutils.annotations.Projection;
    2018
    2119/**
    2220 * Unit tests for class {@link MergeNodesAction}.
    2321 */
     22@Projection
    2423class MergeNodesActionTest {
    25 
    26     /**
    27      * Setup test.
    28      */
    29     @RegisterExtension
    30     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    31     public JOSMTestRules test = new JOSMTestRules().projection();
    32 
    3324    /**
    3425     * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - empty list
     
    3627    @Test
    3728    void testSelectTargetLocationNodeEmpty() {
    38         assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(Collections.emptyList()));
     29        final List<Node> noNodes = Collections.emptyList();
     30        assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(noNodes));
    3931    }
    4032
     
    4537    void testSelectTargetLocationNodeInvalidMode() {
    4638        Config.getPref().putInt("merge-nodes.mode", -1);
    47         assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))));
     39        final List<Node> nodes = Arrays.asList(new Node(0), new Node(1));
     40        assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(nodes));
    4841    }
    4942
     
    6255        Config.getPref().putInt("merge-nodes.mode", 2);
    6356        assertEquals(LatLon.NORTH_POLE, MergeNodesAction.selectTargetLocationNode(
    64                 Arrays.asList(new Node(LatLon.NORTH_POLE))).getCoor());
     57                Collections.singletonList(new Node(LatLon.NORTH_POLE))).getCoor());
    6558    }
    6659
     
    7467        Node n1 = new Node(1);
    7568        ds.addPrimitive(n1);
    76         assertEquals(1, MergeNodesAction.selectTargetNode(Arrays.asList(n1)).getId());
     69        assertEquals(1, MergeNodesAction.selectTargetNode(Collections.singletonList(n1)).getId());
    7770    }
    7871}
  • trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java

    r17275 r18870  
    1212
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.TestUtils;
    1615import org.openstreetmap.josm.actions.OrthogonalizeAction.Direction;
     
    2322import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2423import org.openstreetmap.josm.io.OsmReader;
    25 import org.openstreetmap.josm.testutils.JOSMTestRules;
     24import org.openstreetmap.josm.testutils.annotations.Projection;
    2625import org.openstreetmap.josm.tools.Geometry;
    2726import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    2827
    29 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3028import net.trajano.commons.testing.UtilityClassTestUtil;
    3129
     
    3331 * Unit tests for class {@link OrthogonalizeAction}.
    3432 */
     33@Projection
    3534class OrthogonalizeActionTest {
    36 
    37     /**
    38      * Setup test.
    39      */
    40     @RegisterExtension
    41     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    42     public JOSMTestRules test = new JOSMTestRules().projection();
    43 
    4435    @Test
    45     void testNoSelection() throws Exception {
     36    void testNoSelection() {
    4637        assertThrows(OrthogonalizeAction.InvalidUserInputException.class, () -> performTest("nothing selected"));
    4738    }
  • trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java

    r18487 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.io.FileNotFoundException;
    87import java.io.IOException;
    98import java.io.InputStream;
    109
    11 import org.junit.jupiter.api.extension.RegisterExtension;
    1210import org.junit.jupiter.api.Test;
    1311import org.openstreetmap.josm.TestUtils;
     
    1816import org.openstreetmap.josm.io.IllegalDataException;
    1917import org.openstreetmap.josm.io.OsmReader;
    20 import org.openstreetmap.josm.testutils.JOSMTestRules;
    21 
    22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     18import org.openstreetmap.josm.testutils.annotations.Main;
     19import org.openstreetmap.josm.testutils.annotations.Projection;
    2320
    2421/**
    2522 * Unit tests for class {@link PurgeAction}.
    2623 */
     24@Main
     25@Projection
    2726class PurgeActionTest {
    28 
    29     /**
    30      * Setup test.
    31      */
    32     @RegisterExtension
    33     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    34     public static JOSMTestRules test = new JOSMTestRules().main().projection();
    35 
    3627    /**
    3728     * Non-regression test for ticket #12038.
    3829     * @throws IOException if any I/O error occurs
    39      * @throws FileNotFoundException if the data file cannot be found
    4030     * @throws IllegalDataException if OSM parsing fails
    4131     */
    4232    @Test
    43     void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException {
     33    void testCopyStringWayRelation() throws IOException, IllegalDataException {
    4434        try (InputStream is = TestUtils.getRegressionDataStream(12038, "data.osm")) {
    4535            DataSet ds = OsmReader.parseDataSet(is, null);
  • trunk/test/unit/org/openstreetmap/josm/actions/RestorePropertyActionTest.java

    r18690 r18870  
    88
    99import org.junit.jupiter.api.Test;
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.openstreetmap.josm.command.ChangePropertyCommand;
    1211import org.openstreetmap.josm.data.UndoRedoHandler;
     
    1413import org.openstreetmap.josm.data.osm.DataSet;
    1514import org.openstreetmap.josm.data.osm.Node;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1916
    2017/**
    2118 * Unit tests of {@link RestorePropertyAction}
    2219 */
     20@BasicPreferences
    2321class RestorePropertyActionTest {
    24 
    25     /**
    26      * Setup test.
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().preferences();
    31 
    3222    @Test
    3323    void testTicket20965() {
  • trunk/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java

    r17275 r18870  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.jupiter.api.extension.RegisterExtension;
    76import org.junit.jupiter.api.Test;
    87import org.openstreetmap.josm.data.osm.DataSet;
    98import org.openstreetmap.josm.gui.MainApplication;
    10 import org.openstreetmap.josm.testutils.JOSMTestRules;
    11 
    12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     9import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     10import org.openstreetmap.josm.testutils.annotations.Main;
     11import org.openstreetmap.josm.testutils.annotations.Projection;
    1312
    1413/**
    1514 * Unit tests for class {@link SelectAllAction}.
    1615 */
     16@BasicPreferences
     17@Main
     18@Projection
    1719final class SelectAllActionTest {
    18 
    19     /**
    20      * Setup test.
    21      */
    22     @RegisterExtension
    23     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    24     public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main();
    25 
    2620    /**
    2721     * Unit test of {@link SelectAllAction#actionPerformed} method.
  • trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java

    r17275 r18870  
    77import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.junit.jupiter.api.Test;
    1110import org.openstreetmap.josm.data.coor.EastNorth;
     
    1817import org.openstreetmap.josm.gui.layer.Layer;
    1918import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    20 import org.openstreetmap.josm.testutils.JOSMTestRules;
     19import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     20import org.openstreetmap.josm.testutils.annotations.Main;
     21import org.openstreetmap.josm.testutils.annotations.Projection;
    2122
    22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2323import net.trajano.commons.testing.UtilityClassTestUtil;
    2424
     
    2626 * Unit tests for class {@link SelectByInternalPointAction}.
    2727 */
     28@BasicPreferences
     29@Main
     30@Projection
    2831final class SelectByInternalPointActionTest {
    29 
    30     /**
    31      * Setup test.
    32      */
    33     @RegisterExtension
    34     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main();
    36 
    3732    /**
    3833     * Tests that {@code SelectByInternalPointAction} satisfies utility class criteria.
  • trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java

    r18466 r18870  
    55
    66import org.junit.jupiter.api.Test;
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    8 import org.openstreetmap.josm.testutils.JOSMTestRules;
    9 
    10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     7import org.openstreetmap.josm.testutils.annotations.Main;
    118
    129/**
    1310 * Unit tests for class {@link SessionSaveAsAction}.
    1411 */
     12@Main
    1513class SessionSaveAsActionTest {
    16 
    17     /**
    18      * Setup test.
    19      */
    20     @RegisterExtension
    21     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules().main();
    23 
    2414    /**
    2515     * Unit test of {@link SessionSaveAsAction#actionPerformed}
  • trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java

    r18317 r18870  
    1818import org.junit.jupiter.api.BeforeEach;
    1919import org.junit.jupiter.api.Test;
    20 import org.junit.jupiter.api.extension.RegisterExtension;
    2120import org.openstreetmap.josm.TestUtils;
    2221import org.openstreetmap.josm.command.DeleteCommand;
     
    2928import org.openstreetmap.josm.io.IllegalDataException;
    3029import org.openstreetmap.josm.io.OsmReader;
    31 import org.openstreetmap.josm.testutils.JOSMTestRules;
     30import org.openstreetmap.josm.testutils.annotations.Main;
     31import org.openstreetmap.josm.testutils.annotations.Projection;
    3232import org.openstreetmap.josm.tools.Utils;
    33 
    34 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3533
    3634/**
    3735 * Unit tests for class {@link SimplifyWayAction}.
    3836 */
     37@Main
     38@Projection
    3939final class SimplifyWayActionTest {
    4040
    4141    /** Class under test. */
    4242    private static SimplifyWayAction action;
    43 
    44     /**
    45      * Setup test.
    46      */
    47     @RegisterExtension
    48     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    49     public JOSMTestRules test = new JOSMTestRules().main().projection();
    5043
    5144    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java

    r18690 r18870  
    88
    99import org.junit.jupiter.api.Test;
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.openstreetmap.josm.TestUtils;
    1211import org.openstreetmap.josm.data.coor.EastNorth;
     
    1716import org.openstreetmap.josm.data.osm.RelationMember;
    1817import org.openstreetmap.josm.data.osm.Way;
    19 import org.openstreetmap.josm.testutils.JOSMTestRules;
    20 
    21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     18import org.openstreetmap.josm.testutils.annotations.Projection;
    2219
    2320/**
    2421 * Unit tests for class {@link SplitWayAction}.
    2522 */
     23@Projection
    2624final class SplitWayActionTest {
    27 
    28     /**
    29      * Setup test.
    30      */
    31     @RegisterExtension
    32     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    33     public JOSMTestRules test = new JOSMTestRules().projection();
    3425    private final DataSet dataSet = new DataSet();
    3526
  • trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java

    r17275 r18870  
    77import org.junit.jupiter.api.BeforeEach;
    88import org.junit.jupiter.api.Test;
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.openstreetmap.josm.data.coor.LatLon;
    1110import org.openstreetmap.josm.data.osm.DataSet;
     
    1413import org.openstreetmap.josm.gui.MainApplication;
    1514import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     16import org.openstreetmap.josm.testutils.annotations.Main;
     17import org.openstreetmap.josm.testutils.annotations.Projection;
    1918
    2019/**
    2120 * Unit tests for class {@link UnGlueAction}.
    2221 */
     22@BasicPreferences
     23@Main
     24@Projection
    2325final class UnGlueActionTest {
    2426
    2527    /** Class under test. */
    2628    private static UnGlueAction action;
    27 
    28     /**
    29      * Setup test.
    30      */
    31     @RegisterExtension
    32     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    33     public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
    3429
    3530    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java

    r18487 r18870  
    77
    88import org.junit.jupiter.api.Test;
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.openstreetmap.josm.data.coor.EastNorth;
    1110import org.openstreetmap.josm.data.osm.DataSet;
     
    1413import org.openstreetmap.josm.gui.MainApplication;
    1514import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.Main;
     16import org.openstreetmap.josm.testutils.annotations.Projection;
    1917
    2018/**
    2119 * Unit tests for class {@link UnJoinNodeWayAction}.
    2220 */
     21@Main
     22@Projection
    2323final class UnJoinNodeWayActionTest {
    2424
     
    3333        @Override
    3434        public void notify(String msg, int messageType) {
    35             return;
     35            // Do nothing
    3636        }
    3737    }
    38 
    39     /**
    40      * Setup test.
    41      */
    42     @RegisterExtension
    43     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    44     public static JOSMTestRules test = new JOSMTestRules().projection().main();
    4538
    4639    /**
     
    6558
    6659        Way w = new Way();
    67         w.setNodes(Arrays.asList(new Node[] {n1, n2, n3}));
     60        w.setNodes(Arrays.asList(n1, n2, n3));
    6861        dataSet.addPrimitive(w);
    6962
  • trunk/test/unit/org/openstreetmap/josm/actions/UploadActionTest.java

    r18799 r18870  
    44import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    6 import static org.junit.jupiter.api.Assertions.fail;
    76
    87import java.awt.GraphicsEnvironment;
    98import java.util.Collections;
     9import java.util.concurrent.ExecutionException;
    1010import java.util.concurrent.TimeUnit;
     11import java.util.concurrent.TimeoutException;
    1112
    1213import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.extension.RegisterExtension;
    1414import org.openstreetmap.josm.TestUtils;
    1515import org.openstreetmap.josm.command.AddPrimitivesCommand;
     
    2222import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2323import org.openstreetmap.josm.gui.util.GuiHelper;
    24 import org.openstreetmap.josm.testutils.JOSMTestRules;
    2524import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2625import org.openstreetmap.josm.testutils.annotations.Main;
     26import org.openstreetmap.josm.testutils.annotations.OsmApi;
    2727import org.openstreetmap.josm.testutils.annotations.Projection;
    2828import org.openstreetmap.josm.testutils.annotations.Territories;
     
    4040@BasicPreferences
    4141@Main
     42@OsmApi(OsmApi.APIType.FAKE)
    4243@Projection
    4344// Territories is needed due to test pollution. One of the listeners
     
    4748@Territories(Territories.Initialize.ALL)
    4849class UploadActionTest {
    49     // Only needed for layer cleanup. And user identity cleanup. And ensuring that data isn't accidentally uploaded.
    50     // Note that the setUp method can be replaced by the @Territories extension, when that is merged.
    51     @RegisterExtension
    52     static JOSMTestRules josmTestRules = new JOSMTestRules().fakeAPI();
    53 
    5450    /**
    5551     * Non-regression test for JOSM #21476.
    5652     */
    5753    @Test
    58     void testNonRegression21476() {
     54    void testNonRegression21476() throws ExecutionException, InterruptedException, TimeoutException {
    5955        TestUtils.assumeWorkingJMockit();
    6056        Logging.clearLastErrorAndWarnings();
     
    8480            }).get(1, TimeUnit.SECONDS);
    8581            assertTrue(Logging.getLastErrorAndWarnings().isEmpty());
    86         } catch (Exception exception) {
    87             fail(exception);
    8882        } finally {
    8983            Logging.clearLastErrorAndWarnings();
     
    109103        public final boolean isCanceled(final Invocation invocation) {
    110104            if (!GraphicsEnvironment.isHeadless()) {
    111                 return invocation.proceed();
     105                return Boolean.TRUE.equals(invocation.proceed());
    112106            }
    113107            return true;
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java

    r17275 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    87import org.junit.jupiter.api.Test;
    98import org.openstreetmap.josm.data.osm.DataSet;
     
    1211import org.openstreetmap.josm.gui.MapFrame;
    1312import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    14 import org.openstreetmap.josm.testutils.JOSMTestRules;
    15 
    16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     13import org.openstreetmap.josm.testutils.annotations.Main;
     14import org.openstreetmap.josm.testutils.annotations.Projection;
    1715
    1816/**
    1917 * Unit tests for class {@link AddNoteAction}.
    2018 */
     19@Main
     20@Projection
    2121class AddNoteActionTest {
    22 
    23     /**
    24      * Setup test.
    25      */
    26     @RegisterExtension
    27     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().main().projection();
    29 
    3022    /**
    3123     * Unit test of {@link AddNoteAction#enterMode} and {@link AddNoteAction#exitMode}.
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java

    r17275 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    87import org.junit.jupiter.api.Test;
    98import org.openstreetmap.josm.TestUtils;
     
    1312import org.openstreetmap.josm.gui.MapFrame;
    1413import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    15 import org.openstreetmap.josm.testutils.JOSMTestRules;
    16 
    17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     14import org.openstreetmap.josm.testutils.annotations.Main;
     15import org.openstreetmap.josm.testutils.annotations.Projection;
    1816
    1917/**
    2018 * Unit tests for class {@link DeleteAction}.
    2119 */
     20@Main
     21@Projection
    2222class DeleteActionTest {
    23 
    24     /**
    25      * Setup test.
    26      */
    27     @RegisterExtension
    28     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().main().projection();
    30 
    3123    /**
    3224     * Unit test of {@link DeleteAction#enterMode} and {@link DeleteAction#exitMode}.
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java

    r17275 r18870  
    1414import javax.swing.JList;
    1515
    16 import org.junit.jupiter.api.extension.RegisterExtension;
    1716import org.junit.jupiter.api.Test;
     17import org.junit.jupiter.api.Timeout;
    1818import org.openstreetmap.josm.data.UndoRedoHandler;
    1919import org.openstreetmap.josm.data.coor.EastNorth;
     
    2626import org.openstreetmap.josm.gui.PrimitiveRenderer;
    2727import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    28 import org.openstreetmap.josm.testutils.JOSMTestRules;
    29 
    30 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     28import org.openstreetmap.josm.testutils.annotations.Main;
     29import org.openstreetmap.josm.testutils.annotations.Projection;
    3130
    3231/**
    3332 * Unit tests for class {@link DrawAction}.
    3433 */
     34@Main
     35@Projection
     36@Timeout(20)
    3537class DrawActionTest {
    36 
    37     /**
    38      * Setup test.
    39      */
    40     @RegisterExtension
    41     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    42     public JOSMTestRules test = new JOSMTestRules().main().projection().timeout(20000);
    43 
    4438    /**
    4539     * Non regression test case for bug #12011.
    4640     * Add a new node in the middle of way then undo. The rendering of the node, selected, must not cause any crash in PrimitiveRenderer.
    4741     * @throws SecurityException see {@link Class#getDeclaredField} for details
    48      * @throws NoSuchFieldException see {@link Class#getDeclaredField} for details
    49      * @throws IllegalAccessException see {@link Field#set} for details
    5042     * @throws IllegalArgumentException see {@link Field#set} for details
    5143     */
    5244    @Test
    53     void testTicket12011() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
     45    void testTicket12011() throws IllegalArgumentException, SecurityException {
    5446        DataSet dataSet = new DataSet();
    5547        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    6759
    6860        Way w = new Way();
    69         w.setNodes(Arrays.asList(new Node[] {n1, n2}));
     61        w.setNodes(Arrays.asList(n1, n2));
    7062        dataSet.addPrimitive(w);
    7163
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawSnapHelperTest.java

    r18612 r18870  
    1111import javax.swing.JCheckBoxMenuItem;
    1212
    13 import org.junit.jupiter.api.extension.RegisterExtension;
    1413import org.junit.jupiter.params.ParameterizedTest;
    1514import org.junit.jupiter.params.provider.Arguments;
     
    2625import org.openstreetmap.josm.gui.MainApplication;
    2726import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    28 import org.openstreetmap.josm.testutils.JOSMTestRules;
     27import org.openstreetmap.josm.testutils.annotations.Main;
    2928import org.openstreetmap.josm.tools.Utils;
    3029
     
    3231 * Test class for {@link DrawSnapHelper}
    3332 */
     33@Main
     34@org.openstreetmap.josm.testutils.annotations.Projection
    3435class DrawSnapHelperTest {
    35     @RegisterExtension
    36     static JOSMTestRules rule = new JOSMTestRules().projection().main();
    37 
    3836    static Stream<Arguments> testNonRegression13097() {
    3937        return Stream.of(
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java

    r17275 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    87import org.junit.jupiter.api.Test;
    98import org.openstreetmap.josm.TestUtils;
     
    1312import org.openstreetmap.josm.gui.MapFrame;
    1413import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    15 import org.openstreetmap.josm.testutils.JOSMTestRules;
    16 
    17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     14import org.openstreetmap.josm.testutils.annotations.Main;
     15import org.openstreetmap.josm.testutils.annotations.Projection;
    1816
    1917/**
    2018 * Unit tests for class {@link ExtrudeAction}.
    2119 */
     20@Main
     21@Projection
    2222class ExtrudeActionTest {
    23 
    24     /**
    25      * Setup test.
    26      */
    27     @RegisterExtension
    28     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().main().projection();
    30 
    3123    /**
    3224     * Unit test of {@link ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}.
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java

    r17275 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    87import org.junit.jupiter.api.Test;
    98import org.openstreetmap.josm.TestUtils;
     
    1312import org.openstreetmap.josm.gui.MapFrame;
    1413import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    15 import org.openstreetmap.josm.testutils.JOSMTestRules;
    16 
    17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     14import org.openstreetmap.josm.testutils.annotations.Main;
     15import org.openstreetmap.josm.testutils.annotations.Projection;
    1816
    1917/**
    2018 * Unit tests for class {@link ImproveWayAccuracyAction}.
    2119 */
     20@Main
     21@Projection
    2222class ImproveWayAccuracyActionTest {
    23 
    24     /**
    25      * Setup test.
    26      */
    27     @RegisterExtension
    28     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().main().projection();
    30 
    3123    /**
    3224     * Unit test of {@link ImproveWayAccuracyAction#enterMode} and {@link ImproveWayAccuracyAction#exitMode}.
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java

    r17275 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    87import org.junit.jupiter.api.Test;
    98import org.openstreetmap.josm.TestUtils;
     
    1413import org.openstreetmap.josm.gui.MapFrame;
    1514import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.Main;
     16import org.openstreetmap.josm.testutils.annotations.Projection;
    1917
    2018/**
    2119 * Unit tests for class {@link ParallelWayAction}.
    2220 */
     21@Main
     22@Projection
    2323class ParallelWayActionTest {
    24 
    25     /**
    26      * Setup test.
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().main().projection();
    31 
    3224    /**
    3325     * Unit test of {@link ParallelWayAction#enterMode} and {@link ParallelWayAction#exitMode}.
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java

    r17275 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    87import org.junit.jupiter.api.Test;
    98import org.openstreetmap.josm.data.osm.DataSet;
     
    1211import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1312import org.openstreetmap.josm.gui.layer.markerlayer.PlayHeadMarker;
    14 import org.openstreetmap.josm.testutils.JOSMTestRules;
    15 
    16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     13import org.openstreetmap.josm.testutils.annotations.Main;
     14import org.openstreetmap.josm.testutils.annotations.Projection;
    1715
    1816/**
    1917 * Unit tests for class {@link PlayHeadDragMode}.
    2018 */
     19@Main
     20@Projection
    2121class PlayHeadDragModeTest {
    22 
    23     /**
    24      * Setup test.
    25      */
    26     @RegisterExtension
    27     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().main().projection();
    29 
    3022    /**
    3123     * Unit test of {@link PlayHeadDragMode#enterMode} and {@link PlayHeadDragMode#exitMode}.
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java

    r18526 r18870  
    1313
    1414import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    1615import org.openstreetmap.josm.TestUtils;
    1716import org.openstreetmap.josm.actions.mapmode.SelectAction.Mode;
     
    2625import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2726import org.openstreetmap.josm.spi.preferences.Config;
    28 import org.openstreetmap.josm.testutils.JOSMTestRules;
     27import org.openstreetmap.josm.testutils.annotations.Main;
     28import org.openstreetmap.josm.testutils.annotations.Projection;
    2929import org.openstreetmap.josm.tools.PlatformManager;
    3030import org.openstreetmap.josm.tools.ReflectionUtils;
     
    3535 * Unit tests for class {@link SelectAction}.
    3636 */
     37@Main
     38@Projection
    3739class SelectActionTest {
    3840
     
    5456        }
    5557    }
    56 
    57     /**
    58      * Setup test.
    59      */
    60     @RegisterExtension
    61     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    62     public JOSMTestRules test = new JOSMTestRules().projection().main();
    6358
    6459    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java

    r18690 r18870  
    1212
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.command.PseudoCommand;
    1615import org.openstreetmap.josm.command.SequenceCommand;
     
    2120import org.openstreetmap.josm.data.osm.Relation;
    2221import org.openstreetmap.josm.data.osm.Way;
    23 import org.openstreetmap.josm.testutils.JOSMTestRules;
    24 
    25 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     22import org.openstreetmap.josm.testutils.annotations.Main;
    2623
    2724/**
    2825 * Unit tests for class {@link FixDataHook}.
    2926 */
     27@Main
    3028class FixDataHookTest {
    31 
    32     /**
    33      * Setup test.
    34      */
    35     @RegisterExtension
    36     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    37     public JOSMTestRules test = new JOSMTestRules().main();
    38 
    3929    /**
    4030     * Test of {@link FixDataHook#checkUpload} method.
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/UploadNotesTaskTest.java

    r18443 r18870  
    1515import java.util.stream.Stream;
    1616
    17 import org.junit.jupiter.api.extension.RegisterExtension;
    1817import org.junit.jupiter.params.ParameterizedTest;
    1918import org.junit.jupiter.params.provider.Arguments;
     
    3130import org.openstreetmap.josm.io.OsmTransferException;
    3231import org.openstreetmap.josm.testutils.FakeOsmApi;
    33 import org.openstreetmap.josm.testutils.JOSMTestRules;
    3432import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     33import org.openstreetmap.josm.testutils.annotations.OsmApi;
    3534import org.openstreetmap.josm.tools.Logging;
    3635
     
    4342 */
    4443@BasicPreferences
     44@OsmApi(OsmApi.APIType.FAKE)
    4545class UploadNotesTaskTest {
    46     @RegisterExtension
    47     static JOSMTestRules josmTestRules = new JOSMTestRules().fakeAPI();
    48 
    4946    static Stream<Arguments> testUpload() {
    5047        final NoteData commonData = new NoteData();
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java

    r18776 r18870  
    88import java.util.stream.Stream;
    99
    10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    11 import mockit.Mock;
    1210import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Timeout;
    1412import org.junit.jupiter.params.ParameterizedTest;
    1513import org.junit.jupiter.params.provider.Arguments;
     
    2725import org.openstreetmap.josm.gui.MainApplication;
    2826import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    29 import org.openstreetmap.josm.testutils.JOSMTestRules;
     27import org.openstreetmap.josm.testutils.annotations.Main;
     28import org.openstreetmap.josm.testutils.annotations.OsmApi;
     29import org.openstreetmap.josm.testutils.annotations.Projection;
    3030import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
     31
     32import mockit.Mock;
    3133
    3234/**
    3335 * Unit tests for class {@link ValidateUploadHook}.
    3436 */
     37@Main
     38@OsmApi(OsmApi.APIType.FAKE)
     39@Projection
     40@Timeout(30)
    3541class ValidateUploadHookTest {
    36 
    37     /**
    38      * Setup test.
    39      */
    40     @RegisterExtension
    41     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    42     public JOSMTestRules test = new JOSMTestRules().main().projection().fakeAPI().timeout(30000);
    43 
    4442    /**
    4543     * Test of {@link ValidateUploadHook#checkUpload} method.
  • trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java

    r17275 r18870  
    1414import org.junit.jupiter.api.BeforeEach;
    1515import org.junit.jupiter.api.Test;
    16 import org.junit.jupiter.api.extension.RegisterExtension;
    1716import org.openstreetmap.josm.TestUtils;
    1817import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    2524import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    2625import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    27 import org.openstreetmap.josm.testutils.JOSMTestRules;
    28 
    29 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     26import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     27import org.openstreetmap.josm.testutils.annotations.I18n;
     28import org.openstreetmap.josm.testutils.annotations.Projection;
     29
    3030import nl.jqno.equalsverifier.EqualsVerifier;
    3131import nl.jqno.equalsverifier.Warning;
     
    3434 * Unit tests of {@link MoveCommand} class.
    3535 */
     36@BasicPreferences
     37@I18n
     38@Projection
    3639class MoveCommandTest {
    37     /**
    38      * We need prefs for nodes.
    39      */
    40     @RegisterExtension
    41     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    42     public JOSMTestRules test = new JOSMTestRules().preferences().i18n().projection();
    4340    private CommandTestDataWithRelation testData;
    4441
     
    6057        EastNorth start = new EastNorth(2, 0);
    6158
    62         Set<OsmPrimitive> nodeAsCollection = Collections.<OsmPrimitive>singleton(testData.existingNode);
     59        Set<OsmPrimitive> nodeAsCollection = Collections.singleton(testData.existingNode);
    6360        assertEquals(1, nodeAsCollection.size());
    6461        checkCommandAfterConstructor(new MoveCommand(nodeAsCollection, offset));
     
    221218        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
    222219        ArrayList<OsmPrimitive> added = new ArrayList<>();
    223         new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2).fillModifiedData(modified,
     220        new MoveCommand(Collections.singletonList(testData.existingNode), 1, 2).fillModifiedData(modified,
    224221                deleted, added);
    225222        assertArrayEquals(new Object[] {testData.existingNode }, modified.toArray());
     
    233230    @Test
    234231    void testGetParticipatingPrimitives() {
    235         MoveCommand command = new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2);
     232        MoveCommand command = new MoveCommand(Collections.singletonList(testData.existingNode), 1, 2);
    236233        command.executeCommand();
    237234        assertArrayEquals(new Object[] {testData.existingNode}, command.getParticipatingPrimitives().toArray());
    238235
    239236        MoveCommand command2 = new MoveCommand(
    240                 Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingWay), 1, 2);
     237                Arrays.asList(testData.existingNode, testData.existingWay), 1, 2);
    241238        command2.executeCommand();
    242239        assertArrayEquals(new Object[] {testData.existingNode, testData.existingNode2},
     
    251248        Node node = TestUtils.addFakeDataSet(new Node(LatLon.ZERO));
    252249        node.put("name", "xy");
    253         List<OsmPrimitive> nodeList = Arrays.<OsmPrimitive>asList(node);
     250        List<OsmPrimitive> nodeList = Collections.singletonList(node);
    254251        assertTrue(new MoveCommand(nodeList, 1, 2).getDescriptionText().matches("Move 1 node"));
    255         List<OsmPrimitive> nodes = Arrays.<OsmPrimitive>asList(node, testData.existingNode, testData.existingNode2);
     252        List<OsmPrimitive> nodes = Arrays.asList(node, testData.existingNode, testData.existingNode2);
    256253        assertTrue(new MoveCommand(nodes, 1, 2).getDescriptionText().matches("Move 3 nodes"));
    257254    }
  • trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java

    r17275 r18870  
    77import java.util.ArrayList;
    88import java.util.Arrays;
     9import java.util.Collections;
    910
    1011import org.junit.jupiter.api.BeforeEach;
    1112import org.junit.jupiter.api.Test;
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    2020import org.openstreetmap.josm.data.osm.User;
    2121import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    22 import org.openstreetmap.josm.testutils.JOSMTestRules;
     22import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     23import org.openstreetmap.josm.testutils.annotations.Projection;
    2324
    24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2525import nl.jqno.equalsverifier.EqualsVerifier;
    2626import nl.jqno.equalsverifier.Warning;
     
    2929 * Unit tests of {@link RotateCommand} class.
    3030 */
     31@BasicPreferences
     32@Projection
    3133class RotateCommandTest {
    32 
    33     /**
    34      * We need prefs for nodes.
    35      */
    36     @RegisterExtension
    37     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    38     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    3934    private CommandTestData testData;
    4035
     
    10095        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
    10196        ArrayList<OsmPrimitive> added = new ArrayList<>();
    102         RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode),
     97        RotateCommand command = new RotateCommand(Collections.singletonList(testData.existingNode),
    10398                new EastNorth(0, 0));
    10499        // intentionally empty
     
    114109    @Test
    115110    void testGetParticipatingPrimitives() {
    116         RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0));
     111        RotateCommand command = new RotateCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0));
    117112        command.executeCommand();
    118113        assertArrayEquals(new Object[] {testData.existingNode}, command.getParticipatingPrimitives().toArray());
     
    125120    void testDescription() {
    126121        assertEquals("Rotate 1 node",
    127                 new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0))
     122                new RotateCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0))
    128123                        .getDescriptionText());
    129124        assertEquals("Rotate 2 nodes",
  • trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java

    r17275 r18870  
    77import java.util.ArrayList;
    88import java.util.Arrays;
     9import java.util.Collections;
    910
    1011import org.junit.jupiter.api.BeforeEach;
    1112import org.junit.jupiter.api.Test;
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    2020import org.openstreetmap.josm.data.osm.User;
    2121import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    22 import org.openstreetmap.josm.testutils.JOSMTestRules;
     22import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     23import org.openstreetmap.josm.testutils.annotations.Projection;
    2324
    24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2525import nl.jqno.equalsverifier.EqualsVerifier;
    2626import nl.jqno.equalsverifier.Warning;
     
    2929 * Unit tests of {@link ScaleCommand} class.
    3030 */
     31@BasicPreferences
     32@Projection
    3133class ScaleCommandTest {
    32 
    33     /**
    34      * We need prefs for nodes.
    35      */
    36     @RegisterExtension
    37     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    38     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    3934    private CommandTestData testData;
    4035
     
    10095        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
    10196        ArrayList<OsmPrimitive> added = new ArrayList<>();
    102         ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode),
     97        ScaleCommand command = new ScaleCommand(Collections.singletonList(testData.existingNode),
    10398                new EastNorth(0, 0));
    10499        // intentionally empty
     
    114109    @Test
    115110    void testGetParticipatingPrimitives() {
    116         ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0));
     111        ScaleCommand command = new ScaleCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0));
    117112        command.executeCommand();
    118113        assertArrayEquals(new Object[] {testData.existingNode }, command.getParticipatingPrimitives().toArray());
     
    125120    void testDescription() {
    126121        assertEquals("Scale 1 node",
    127                 new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0))
     122                new ScaleCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0))
    128123                        .getDescriptionText());
    129124        assertEquals("Scale 2 nodes",
  • trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java

    r18539 r18870  
    1818
    1919import org.junit.jupiter.api.Test;
    20 import org.junit.jupiter.api.extension.RegisterExtension;
    2120import org.junit.jupiter.params.ParameterizedTest;
    2221import org.junit.jupiter.params.provider.Arguments;
     
    3837import org.openstreetmap.josm.io.IllegalDataException;
    3938import org.openstreetmap.josm.io.OsmReader;
    40 import org.openstreetmap.josm.testutils.JOSMTestRules;
    41 
    42 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     39import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     40import org.openstreetmap.josm.testutils.annotations.Main;
     41import org.openstreetmap.josm.testutils.annotations.Projection;
    4342
    4443/**
    4544 * Unit tests for class {@link SplitWayCommand}.
    4645 */
     46@BasicPreferences
     47@Main
     48@Projection
    4749final class SplitWayCommandTest {
    48 
    49     /**
    50      * Setup test.
    51      */
    52     @RegisterExtension
    53     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    54     static JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
    55 
    5650    /**
    5751     * Unit test of {@link SplitWayCommand#findVias}.
     
    303297    /**
    304298     * Non-regression test for issue #17400 (Warn when splitting way in not fully downloaded region)
    305      *
     299     * <p>
    306300     * Bus route 190 gets broken when the split occurs, because the two new way parts are inserted in the relation in
    307301     * the wrong order.
     
    348342    /**
    349343     * Non-regression test for issue #18863 (Asking for download of missing members when not needed)
    350      *
     344     * <p>
    351345     * A split on node 4518025255 caused the 'download missing members?' dialog to pop up for relation 68745 (CB 2),
    352346     * even though the way members next to the split way were already downloaded. This happened because this relation
    353347     * does not have its members connected at all.
    354      *
     348     * <p>
    355349     * This split should not trigger any download action at all.
    356350     *
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java

    r18853 r18870  
    1010import org.openstreetmap.josm.data.osm.Way;
    1111import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     12import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
    1213
    1314import nl.jqno.equalsverifier.EqualsVerifier;
     
    1718 * Unit tests of {@link DeletedStateConflictResolveCommand} class.
    1819 */
     20@MapPaintStyles
    1921class DeletedStateConflictResolveCommandTest {
    2022    /**
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java

    r18853 r18870  
    1010import org.openstreetmap.josm.data.osm.Way;
    1111import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     12import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
    1213
    1314import nl.jqno.equalsverifier.EqualsVerifier;
     
    1718 * Unit tests of {@link ModifiedConflictResolveCommand} class.
    1819 */
     20@MapPaintStyles
    1921class ModifiedConflictResolveCommandTest {
    2022    /**
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java

    r18853 r18870  
    1010import org.openstreetmap.josm.data.osm.User;
    1111import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     12import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
    1213
    1314import nl.jqno.equalsverifier.EqualsVerifier;
     
    1718 * Unit tests of {@link RelationMemberConflictResolverCommand} class.
    1819 */
     20@MapPaintStyles
    1921class RelationMemberConflictResolverCommandTest {
    2022    /**
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java

    r18853 r18870  
    1010import org.openstreetmap.josm.data.osm.Way;
    1111import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     12import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
    1213
    1314import nl.jqno.equalsverifier.EqualsVerifier;
     
    1718 * Unit tests of {@link TagConflictResolveCommand} class.
    1819 */
     20@MapPaintStyles
    1921class TagConflictResolveCommandTest {
    2022    /**
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java

    r18853 r18870  
    1010import org.openstreetmap.josm.data.osm.Way;
    1111import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     12import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
    1213
    1314import nl.jqno.equalsverifier.EqualsVerifier;
     
    1718 * Unit tests of {@link VersionConflictResolveCommand} class.
    1819 */
     20@MapPaintStyles
    1921class VersionConflictResolveCommandTest {
    2022    /**
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java

    r18853 r18870  
    1010import org.openstreetmap.josm.data.osm.Way;
    1111import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     12import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
    1213
    1314import nl.jqno.equalsverifier.EqualsVerifier;
     
    1718 * Unit tests of {@link WayNodesConflictResolverCommand} class.
    1819 */
     20@MapPaintStyles
    1921class WayNodesConflictResolverCommandTest {
    2022    /**
  • trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java

    r17275 r18870  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.jupiter.api.extension.RegisterExtension;
    76import org.junit.jupiter.api.Test;
    8 import org.openstreetmap.josm.testutils.JOSMTestRules;
    9 
    10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     7import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     8import org.openstreetmap.josm.testutils.annotations.OsmApi;
    119
    1210/**
    1311 * Unit tests of {@link Preferences}.
    1412 */
     13@BasicPreferences
     14@OsmApi(OsmApi.APIType.FAKE)
    1515class PreferencesTest {
    16 
    17     /**
    18      * Setup test.
    19      */
    20     @RegisterExtension
    21     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
    23 
    2416    /**
    2517     * Test {@link Preferences#toXML}.
  • trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java

    r17275 r18870  
    1313import org.apache.commons.jcs3.access.behavior.ICacheAccess;
    1414import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
     15import org.junit.jupiter.api.Timeout;
    1616import org.openstreetmap.josm.data.imagery.TMSCachedTileLoader;
    1717import org.openstreetmap.josm.data.imagery.TileJobOptions;
    18 import org.openstreetmap.josm.testutils.JOSMTestRules;
     18import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1919import org.openstreetmap.josm.tools.Logging;
    2020
    21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    22 
    2321/**
    24  * Simple tests for ThreadPoolExecutor / HostLimitQueue veryfing, that this pair works OK
     22 * Simple tests for ThreadPoolExecutor / HostLimitQueue verifying, that this pair works OK
    2523 * @author Wiktor Niesiobedzki
    2624 */
     25@BasicPreferences
     26@Timeout(20)
    2727class HostLimitQueueTest {
    28     /**
    29      * Setup test.
    30      */
    31     @RegisterExtension
    32     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    33     public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20 * 1000);
    34 
    3528    /**
    3629     * Mock class for tests
  • trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java

    r18494 r18870  
    1111
    1212import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.extension.RegisterExtension;
    1413import org.openstreetmap.josm.TestUtils;
    1514import org.openstreetmap.josm.data.Bounds;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
     15import org.openstreetmap.josm.testutils.annotations.Projection;
    1716
    1817import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    2221 * Unit tests for class {@link LatLon}.
    2322 */
     23@Projection
    2424public class LatLonTest {
    25 
    26     /**
    27      * Setup test.
    28      */
    29     @RegisterExtension
    30     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    31     public JOSMTestRules test = new JOSMTestRules().projection();
    32 
    3325    private static final double EPSILON = 1e-6;
    3426
     
    156148
    157149    /**
    158      * Unit test of {@link LatLon#LatLon(LatLon)}.
     150     * Unit test of {@link LatLon#LatLon(ILatLon)}.
    159151     */
    160152    @Test
  • trunk/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java

    r17275 r18870  
    77import java.text.DecimalFormat;
    88
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.junit.jupiter.api.Test;
    1110import org.openstreetmap.josm.TestUtils;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
     11import org.openstreetmap.josm.testutils.annotations.Projection;
    1312
    14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1513import nl.jqno.equalsverifier.EqualsVerifier;
    1614
     
    1816 * Test the {@link PolarCoor} class.
    1917 */
     18@Projection
    2019class PolarCoorTest {
    21 
    22     /**
    23      * Setup test.
    24      */
    25     @RegisterExtension
    26     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    27     public JOSMTestRules test = new JOSMTestRules().projection();
    28 
    2920    /**
    3021     * Test {@link PolarCoor#PolarCoor}
  • trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java

    r17275 r18870  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    7 
    8 import org.junit.jupiter.api.extension.RegisterExtension;
    96import org.junit.jupiter.api.Test;
    107import org.openstreetmap.josm.data.coor.ILatLon;
    118import org.openstreetmap.josm.data.coor.LatLon;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
     9import org.openstreetmap.josm.testutils.annotations.Projection;
    1310
    1411/**
    1512 * Test for {@link ICoordinateFormat} implementations.
    1613 */
     14@Projection
    1715class ICoordinateFormatTest {
    18     /**
    19      * Setup test.
    20      */
    21     @RegisterExtension
    22     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().projection();
    24 
    2516    /**
    2617     * Tests {@link ICoordinateFormat#latToString(org.openstreetmap.josm.data.coor.ILatLon)}
  • trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java

    r17275 r18870  
    66
    77import org.junit.jupiter.api.Test;
    8 import org.junit.jupiter.api.extension.RegisterExtension;
    98import org.openstreetmap.josm.data.coor.LatLon;
    10 import org.openstreetmap.josm.testutils.JOSMTestRules;
    11 
    12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     9import org.openstreetmap.josm.testutils.annotations.Projection;
    1310
    1411/**
    1512 * Unit tests for class {@link LatLonParser}.
    1613 */
     14@Projection
    1715class LatLonParserTest {
    18 
    19     /**
    20      * Setup test.
    21      */
    22     @RegisterExtension
    23     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    24     public JOSMTestRules test = new JOSMTestRules().projection();
    25 
    2616    /**
    2717     * Unit test of {@link LatLonParser#parse} method.
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java

    r18494 r18870  
    2121import org.junit.jupiter.api.BeforeEach;
    2222import org.junit.jupiter.api.Test;
    23 import org.junit.jupiter.api.extension.RegisterExtension;
    2423import org.openstreetmap.josm.TestUtils;
    2524import org.openstreetmap.josm.data.Bounds;
     
    3231import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    3332import org.openstreetmap.josm.io.GpxReaderTest;
    34 import org.openstreetmap.josm.testutils.JOSMTestRules;
     33import org.openstreetmap.josm.testutils.annotations.Projection;
    3534import org.openstreetmap.josm.tools.ListenerList;
    3635import org.openstreetmap.josm.tools.date.Interval;
    3736import org.xml.sax.SAXException;
    3837
    39 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    4038import nl.jqno.equalsverifier.EqualsVerifier;
    4139import nl.jqno.equalsverifier.Warning;
     
    4442 * Unit tests for class {@link GpxData}.
    4543 */
     44@Projection
    4645class GpxDataTest {
    47 
    48     /**
    49      * Setup test.
    50      */
    51     @RegisterExtension
    52     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    53     public JOSMTestRules test = new JOSMTestRules().projection();
    54 
    5546    private GpxData data;
    5647
     
    339330        p2.setInstant(Instant.ofEpochMilli(200020));
    340331
    341         data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p2)), Collections.emptyMap()));
    342         data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1)), Collections.emptyMap()));
     332        data.addTrack(new GpxTrack(Collections.singletonList(Collections.singletonList(p2)), Collections.emptyMap()));
     333        data.addTrack(new GpxTrack(Collections.singletonList(Collections.singletonList(p1)), Collections.emptyMap()));
    343334
    344335        List<IGpxTrack> tracks = data.getOrderedTracks();
     
    364355        p2.setInstant(Instant.ofEpochMilli(100020));
    365356        p4.setInstant(Instant.ofEpochMilli(500020));
    366         data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1, p2)), Collections.emptyMap()));
    367         data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
     357        data.addTrack(new GpxTrack(Collections.singletonList(Arrays.asList(p1, p2)), Collections.emptyMap()));
     358        data.addTrack(new GpxTrack(Collections.singletonList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
    368359
    369360        Interval times = data.getMinMaxTimeForAllTracks().orElse(null);
     
    383374                .map(WayPoint::new)
    384375                .collect(Collectors.toList());
    385         data.addTrack(new GpxTrack(Arrays.asList(points), Collections.emptyMap()));
     376        data.addTrack(new GpxTrack(Collections.singletonList(points), Collections.emptyMap()));
    386377
    387378        WayPoint closeToMiddle = data.nearestPointOnTrack(new EastNorth(10, 0), 10);
     
    406397        DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test");
    407398        data.dataSources.add(ds);
    408         assertEquals(new ArrayList<>(Arrays.asList(ds)), new ArrayList<>(data.getDataSources()));
     399        assertEquals(new ArrayList<>(Collections.singletonList(ds)), new ArrayList<>(data.getDataSources()));
    409400    }
    410401
     
    429420        DataSource ds = new DataSource(bounds, "test");
    430421        data.dataSources.add(ds);
    431         assertEquals(Arrays.asList(bounds), data.getDataSourceBounds());
     422        assertEquals(Collections.singletonList(bounds), data.getDataSourceBounds());
    432423    }
    433424
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java

    r18766 r18870  
    1818import org.openstreetmap.josm.data.projection.Projections;
    1919import org.openstreetmap.josm.spi.preferences.Config;
     20import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2021import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
     22import org.openstreetmap.josm.testutils.annotations.Projection;
    2123
    2224import com.github.tomakehurst.wiremock.WireMockServer;
    2325import com.github.tomakehurst.wiremock.client.WireMock;
    2426
    25 import org.openstreetmap.josm.testutils.annotations.Projection;
    26 
     27@BasicPreferences(true)
    2728@BasicWiremock
    2829@Projection
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyleTest.java

    r18723 r18870  
    2929
    3030import javax.imageio.ImageIO;
    31 import jakarta.json.Json;
    32 import jakarta.json.JsonObject;
    33 import jakarta.json.JsonObjectBuilder;
    34 import jakarta.json.JsonReader;
    35 import jakarta.json.JsonStructure;
    36 import jakarta.json.JsonValue;
    3731
    3832import org.awaitility.Awaitility;
    3933import org.awaitility.Durations;
    4034import org.junit.jupiter.api.Test;
    41 import org.junit.jupiter.api.extension.RegisterExtension;
    4235import org.junit.jupiter.api.io.TempDir;
    4336import org.openstreetmap.josm.TestUtils;
     
    4942import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule;
    5043import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
    51 import org.openstreetmap.josm.testutils.JOSMTestRules;
     44import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    5245import org.openstreetmap.josm.tools.ColorHelper;
    5346import org.openstreetmap.josm.tools.ImageProvider;
    5447
     48import jakarta.json.Json;
     49import jakarta.json.JsonObject;
     50import jakarta.json.JsonObjectBuilder;
     51import jakarta.json.JsonReader;
     52import jakarta.json.JsonStructure;
     53import jakarta.json.JsonValue;
    5554import nl.jqno.equalsverifier.EqualsVerifier;
    5655
     
    5958 * @author Taylor Smock
    6059 */
    61 public class MapboxVectorStyleTest {
     60// Needed for osm primitives (we really just need to initialize the config)
     61// OSM primitives are called when we load style sources
     62@BasicPreferences
     63class MapboxVectorStyleTest {
    6264    /** Used to store sprite files (specifically, sprite{,@2x}.{png,json}) */
    6365    @TempDir
    6466    File spritesDirectory;
    65 
    66     // Needed for osm primitives (we really just need to initialize the config)
    67     // OSM primitives are called when we load style sources
    68     @RegisterExtension
    69     JOSMTestRules rules = new JOSMTestRules();
    7067
    7168    /** The base information */
     
    8784    void testVersionChecks() {
    8885        assertThrows(NullPointerException.class, () -> new MapboxVectorStyle(JsonValue.EMPTY_JSON_OBJECT));
    89         IllegalArgumentException badVersion = assertThrows(IllegalArgumentException.class,
    90           () -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 7).build()));
     86        final JsonObject style7 = Json.createObjectBuilder().add("version", 7).build();
     87        IllegalArgumentException badVersion = assertThrows(IllegalArgumentException.class, () -> new MapboxVectorStyle(style7));
    9188        assertEquals("Vector Tile Style Version not understood: version 7 (json: {\"version\":7})", badVersion.getMessage());
    92         badVersion = assertThrows(IllegalArgumentException.class,
    93           () -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 9).build()));
     89        final JsonObject style9 = Json.createObjectBuilder().add("version", 9).build();
     90        badVersion = assertThrows(IllegalArgumentException.class, () -> new MapboxVectorStyle(style9));
    9491        assertEquals("Vector Tile Style Version not understood: version 9 (json: {\"version\":9})", badVersion.getMessage());
    9592        assertDoesNotThrow(() -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 8).build()));
  • trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java

    r17275 r18870  
    66import java.io.InputStream;
    77
    8 import org.junit.jupiter.api.extension.RegisterExtension;
    98import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.Timeout;
    1010import org.openstreetmap.josm.TestUtils;
    1111import org.openstreetmap.josm.io.OsmReader;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
    13 
    14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     12import org.openstreetmap.josm.testutils.annotations.Projection;
    1513
    1614/**
    1715 * Unit tests of the {@code MultipolygonBuilder} class.
    1816 */
     17@Projection
     18@Timeout(15)
    1919class MultipolygonBuilderTest {
    20 
    21     /**
    22      * Setup test.
    23      */
    24     @RegisterExtension
    25     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules test = new JOSMTestRules().projection().timeout(15000);
    27 
    2820    /**
    2921     * Non-regression test for ticket #12376.
  • trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java

    r17275 r18870  
    66import static org.junit.jupiter.api.Assertions.assertNotNull;
    77import static org.junit.jupiter.api.Assertions.assertNull;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
    89import static org.junit.jupiter.api.Assertions.assertTrue;
    9 import static org.junit.jupiter.api.Assertions.assertThrows;
    1010
    1111import org.junit.jupiter.api.Test;
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1312import org.openstreetmap.josm.data.Bounds;
    1413import org.openstreetmap.josm.data.DataSource;
    1514import org.openstreetmap.josm.data.coor.EastNorth;
    1615import org.openstreetmap.josm.data.coor.LatLon;
    17 import org.openstreetmap.josm.testutils.JOSMTestRules;
    18 
    19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     16import org.openstreetmap.josm.testutils.annotations.Projection;
    2017
    2118/**
    2219 * Unit tests of the {@code Node} class.
    2320 */
     21@Projection
    2422class NodeTest {
    25 
    26     /**
    27      * Setup test.
    28      */
    29     @RegisterExtension
    30     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    31     public JOSMTestRules test = new JOSMTestRules().projection();
    32 
    3323    /**
    3424     * Non-regression test for ticket #12060.
  • trunk/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java

    r18009 r18870  
    88import static org.junit.jupiter.api.Assertions.assertTrue;
    99
    10 import java.util.Arrays;
     10import java.util.Collections;
    1111import java.util.List;
    1212
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.data.coor.LatLon;
    1615import org.openstreetmap.josm.data.notes.Note;
    1716import org.openstreetmap.josm.data.notes.Note.State;
    1817import org.openstreetmap.josm.data.notes.NoteComment;
    19 import org.openstreetmap.josm.testutils.JOSMTestRules;
    20 
    21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     18import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2219
    2320/**
    2421 * Unit tests of the {@code NoteData} class.
    2522 */
     23@BasicPreferences
    2624class NoteDataTest {
    27 
    28     /**
    29      * Setup test.
    30      */
    31     @RegisterExtension
    32     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    33     public JOSMTestRules test = new JOSMTestRules().preferences();
    34 
    3525    /**
    3626     * Unit test for {@link NoteData#NoteData}
     
    4030        NoteData empty = new NoteData();
    4131        assertEquals(0, empty.getNotes().size());
    42         NoteData notEmpty = new NoteData(Arrays.asList(new Note(LatLon.ZERO)));
     32        NoteData notEmpty = new NoteData(Collections.singletonList(new Note(LatLon.ZERO)));
    4333        assertEquals(1, notEmpty.getNotes().size());
    4434    }
     
    5444        assertTrue(note.getComments().isEmpty());
    5545
    56         NoteData data = new NoteData(Arrays.asList(note));
     46        NoteData data = new NoteData(Collections.singletonList(note));
    5747        data.closeNote(note, "foo");
    5848
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java

    r17275 r18870  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.jupiter.api.extension.RegisterExtension;
    76import org.junit.jupiter.api.Test;
    87import org.openstreetmap.josm.spi.preferences.Config;
    9 import org.openstreetmap.josm.testutils.JOSMTestRules;
    10 
    11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     8import org.openstreetmap.josm.testutils.annotations.OsmApi;
    129
    1310/**
    1411 * Unit tests of {@link JosmUrls} class.
    1512 */
     13@OsmApi(OsmApi.APIType.DEV)
    1614class JosmUrlsTest {
    17 
    18     /**
    19      * Setup test.
    20      */
    21     @RegisterExtension
    22     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().devAPI();
    24 
    2515    /**
    2616     * Unit test of {@link JosmUrls#getBaseUserUrl}.
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r18690 r18870  
    3737
    3838import org.junit.jupiter.api.Test;
    39 import org.junit.jupiter.api.extension.RegisterExtension;
     39import org.junit.jupiter.api.Timeout;
    4040import org.openstreetmap.josm.data.Bounds;
    4141import org.openstreetmap.josm.data.coor.EastNorth;
    4242import org.openstreetmap.josm.data.coor.LatLon;
    4343import org.openstreetmap.josm.gui.preferences.projection.CodeProjectionChoice;
    44 import org.openstreetmap.josm.testutils.JOSMTestRules;
     44import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids;
    4545import org.openstreetmap.josm.tools.Pair;
    4646import org.openstreetmap.josm.tools.PlatformManager;
     
    5757 * can be accessed, i.e. copy them from <code>nodist/data/projection</code> to <code>/usr/share/proj</code> or
    5858 * wherever cs2cs expects them to be placed.
    59  *
     59 * <p>
    6060 * The input parameter for the external library is <em>not</em> the projection code
    6161 * (e.g. "EPSG:25828"), but the entire definition, (e.g. "+proj=utm +zone=28 +ellps=GRS80 +nadgrids=null").
     
    6363 * of the algorithm, given a certain definition.
    6464 */
     65@ProjectionNadGrids
     66@Timeout(90)
    6567class ProjectionRefTest {
    6668
     
    8688    static boolean debug;
    8789    static List<String> forcedCodes;
    88 
    89     /**
    90      * Setup test.
    91      */
    92     @RegisterExtension
    93     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    94     public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().timeout(90_000);
    9590
    9691    /**
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r18853 r18870  
    2525import org.openstreetmap.josm.data.coor.EastNorth;
    2626import org.openstreetmap.josm.data.coor.LatLon;
     27import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids;
    2728import org.openstreetmap.josm.tools.Pair;
    2829import org.openstreetmap.josm.tools.Platform;
     
    138139     * @throws IOException if any I/O error occurs
    139140     */
     141    @ProjectionNadGrids
    140142    @Test
    141143    void testNonRegression() throws IOException {
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java

    r18690 r18870  
    1616import org.openstreetmap.josm.data.coor.ILatLon;
    1717import org.openstreetmap.josm.data.coor.LatLon;
     18import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids;
    1819
    1920/**
     
    3031     * Tests that projections are numerically stable in their definition bounds (round trip error &lt; 1e-5)
    3132     */
     33    @ProjectionNadGrids
    3234    @Test
    3335    void testProjections() {
  • trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java

    r17275 r18870  
    77import org.junit.jupiter.api.BeforeAll;
    88import org.junit.jupiter.api.Test;
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.openstreetmap.josm.data.coor.EastNorth;
    1110import org.openstreetmap.josm.data.coor.LatLon;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
    13 
    14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     11import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids;
    1512
    1613/**
    1714 * Unit tests for the Swiss projection grid.
    1815 */
     16@ProjectionNadGrids
    1917class SwissGridTest {
    2018    private static final String SWISS_EPSG_CODE = "EPSG:21781";
    2119    private final boolean debug = false;
    22 
    23     /**
    24      * Setup test.
    25      */
    26     @RegisterExtension
    27     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().projectionNadGrids();
    2920
    3021    /**
  • trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java

    r17275 r18870  
    88import org.junit.jupiter.api.BeforeEach;
    99import org.junit.jupiter.api.Test;
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.openstreetmap.josm.data.validation.tests.Addresses;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
     11import org.openstreetmap.josm.testutils.annotations.Projection;
    1312
    14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1513import net.trajano.commons.testing.UtilityClassTestUtil;
    1614
     
    1816 * Unit tests for class {@link OsmValidator}.
    1917 */
     18@Projection
    2019class OsmValidatorTest {
    21 
    22     /**
    23      * Setup test.
    24      */
    25     @RegisterExtension
    26     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    27     public JOSMTestRules test = new JOSMTestRules().projection();
    28 
    2920    /**
    3021     * Setup test.
  • trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java

    r18799 r18870  
    2525import java.util.stream.Stream;
    2626
    27 import jakarta.json.Json;
    28 import jakarta.json.JsonObject;
    29 import jakarta.json.JsonReader;
    30 
    31 import mockit.Mock;
    32 import mockit.MockUp;
    3327import org.junit.jupiter.api.AfterEach;
    3428import org.junit.jupiter.api.BeforeEach;
     
    5044import org.openstreetmap.josm.testutils.annotations.AnnotationUtils;
    5145import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     46import org.openstreetmap.josm.testutils.annotations.Territories;
    5247import org.openstreetmap.josm.testutils.annotations.ThreadSync;
    5348import org.openstreetmap.josm.tools.Logging;
    5449import org.openstreetmap.josm.tools.Utils;
     50
     51import jakarta.json.Json;
     52import jakarta.json.JsonObject;
     53import jakarta.json.JsonReader;
     54import mockit.Mock;
     55import mockit.MockUp;
    5556
    5657/**
     
    5960 */
    6061@BasicPreferences
     62@Territories
    6163class ValidatorCLITest {
    6264    @RegisterExtension
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java

    r17434 r18870  
    77import org.junit.jupiter.api.BeforeEach;
    88import org.junit.jupiter.api.Test;
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    10 import org.openstreetmap.josm.testutils.JOSMTestRules;
    11 
    12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     9import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
    1310
    1411/**
    1512 * Unit test of {@link ConditionalKeys}.
    1613 */
     14@TaggingPresets
    1715class ConditionalKeysTest {
    1816
    1917    private final ConditionalKeys test = new ConditionalKeys();
    20 
    21     /**
    22      * Setup test
    23      */
    24     @RegisterExtension
    25     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules rule = new JOSMTestRules().presets();
    2718
    2819    /**
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java

    r17430 r18870  
    1212
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.TestUtils;
    1615import org.openstreetmap.josm.data.coor.EastNorth;
     
    2524import org.openstreetmap.josm.data.validation.tests.CrossingWays.Ways;
    2625import org.openstreetmap.josm.io.OsmReader;
    27 import org.openstreetmap.josm.testutils.JOSMTestRules;
    28 
    29 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     26import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     27import org.openstreetmap.josm.testutils.annotations.Projection;
    3028
    3129/**
    3230 * Unit test of {@link CrossingWays}.
    3331 */
     32@BasicPreferences
     33@Projection
    3434class CrossingWaysTest {
    35 
    36     /**
    37      * Setup test
    38      */
    39     @RegisterExtension
    40     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    41     public JOSMTestRules rule = new JOSMTestRules().preferences().projection();
    42 
    4335    private static Way newUsableWay(String tags) {
    4436        return TestUtils.newWay(tags, new Node(LatLon.NORTH_POLE), new Node(LatLon.ZERO));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java

    r17275 r18870  
    88import java.util.stream.Collectors;
    99
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.junit.jupiter.api.Test;
    1211import org.openstreetmap.josm.TestUtils;
    1312import org.openstreetmap.josm.data.osm.Relation;
    1413import org.openstreetmap.josm.io.OsmReader;
    15 import org.openstreetmap.josm.testutils.JOSMTestRules;
    16 
    17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     14import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     15import org.openstreetmap.josm.testutils.annotations.Main;
     16import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
     17import org.openstreetmap.josm.testutils.annotations.Projection;
     18import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
    1819
    1920/**
    2021 * JUnit Test of Multipolygon validation test.
    2122 */
     23@BasicPreferences
     24@Main
     25@MapPaintStyles
     26@Projection
     27@TaggingPresets
    2228class MultipolygonTestTest {
    23 
    24 
    25     /**
    26      * Setup test.
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main().preferences();
    31 
    3229    /**
    3330     * Test all error cases manually created in multipolygon.osm.
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java

    r18376 r18870  
    99
    1010import org.junit.jupiter.api.Test;
    11 import org.junit.jupiter.api.extension.RegisterExtension;
    1211import org.openstreetmap.josm.TestUtils;
    1312import org.openstreetmap.josm.data.osm.Node;
     
    1716import org.openstreetmap.josm.data.osm.Way;
    1817import org.openstreetmap.josm.data.validation.TestError;
    19 import org.openstreetmap.josm.testutils.JOSMTestRules;
    20 
    21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     18import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
    2219
    2320/**
    2421 * Unit tests of {@link RelationChecker} class.
    2522 */
     23@TaggingPresets
    2624class RelationCheckerTest {
    27     /**
    28      * Setup test.
    29      */
    30     @RegisterExtension
    31     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    32     public JOSMTestRules rule = new JOSMTestRules().presets();
    33 
    3425    private static RelationChecker getRelationChecker() {
    3526        RelationChecker checker = new RelationChecker();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java

    r18690 r18870  
    1414import org.junit.jupiter.api.Disabled;
    1515import org.junit.jupiter.api.Test;
    16 import org.junit.jupiter.api.extension.RegisterExtension;
    1716import org.openstreetmap.josm.TestUtils;
    1817import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2120import org.openstreetmap.josm.data.validation.Severity;
    2221import org.openstreetmap.josm.data.validation.TestError;
    23 import org.openstreetmap.josm.testutils.JOSMTestRules;
    24 
    25 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     22import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
    2623
    2724/**
    2825 * JUnit Test of {@link TagChecker}.
    2926 */
     27@TaggingPresets
    3028class TagCheckerTest {
    31 
    32     /**
    33      * Setup test.
    34      */
    35     @RegisterExtension
    36     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    37     public JOSMTestRules rule = new JOSMTestRules().presets();
    38 
    3929    List<TestError> test(OsmPrimitive primitive) throws IOException {
    4030        final TagChecker checker = new TagChecker() {
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java

    r18690 r18870  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import org.junit.jupiter.api.extension.RegisterExtension;
    54import org.junit.jupiter.api.Test;
    65import org.openstreetmap.josm.data.osm.DataSet;
    7 import org.openstreetmap.josm.testutils.JOSMTestRules;
    8 
    9 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     6import org.openstreetmap.josm.testutils.annotations.Main;
     7import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
     8import org.openstreetmap.josm.testutils.annotations.Projection;
     9import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
    1010
    1111/**
    1212 * JUnit Test of turn restriction validation test.
    1313 */
     14@Main
     15@MapPaintStyles
     16@Projection
     17@TaggingPresets
    1418class TurnRestrictionTestTest {
    1519
    1620    private static final TurnrestrictionTest TURNRESTRICTION_TEST = new TurnrestrictionTest();
    1721    private static final RelationChecker RELATION_TEST = new RelationChecker();
    18 
    19     /**
    20      * Setup test.
    21      */
    22     @RegisterExtension
    23     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    24     public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main();
    2522
    2623    /**
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java

    r17275 r18870  
    99import java.util.List;
    1010
    11 import org.junit.jupiter.api.extension.RegisterExtension;
    1211import org.junit.jupiter.api.Test;
    1312import org.openstreetmap.josm.data.coor.LatLon;
     
    1918import org.openstreetmap.josm.data.osm.Way;
    2019import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    21 import org.openstreetmap.josm.testutils.JOSMTestRules;
    22 
    23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     20import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
     21import org.openstreetmap.josm.testutils.annotations.Projection;
     22import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
    2423
    2524/**
    2625 * JUnit Test of unclosed ways validation test.
    2726 */
     27@MapPaintStyles
     28@Projection
     29@TaggingPresets
    2830class UnclosedWaysTest {
    29 
    30     /**
    31      * Setup test.
    32      */
    33     @RegisterExtension
    34     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets();
    36 
    3731    private static Way createUnclosedWay(String tags, DataSet ds) {
    3832        List<Node> nodes = new ArrayList<>();
  • trunk/test/unit/org/openstreetmap/josm/data/vector/VectorDataSetTest.java

    r18478 r18870  
    1515import org.junit.jupiter.api.BeforeEach;
    1616import org.junit.jupiter.api.RepeatedTest;
    17 import org.junit.jupiter.api.extension.RegisterExtension;
    1817import org.openstreetmap.josm.TestUtils;
    1918import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    2221import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MapboxVectorTileSource;
    2322import org.openstreetmap.josm.gui.layer.imagery.MVTLayer;
    24 import org.openstreetmap.josm.testutils.JOSMTestRules;
     23import org.openstreetmap.josm.testutils.annotations.Projection;
    2524
    2625/**
    2726 * A test for {@link VectorDataSet}
    2827 */
     28@Projection
    2929class VectorDataSetTest {
    3030    /**
     
    6363        }
    6464    }
    65 
    66     @RegisterExtension
    67     JOSMTestRules rule = new JOSMTestRules().projection();
    6865
    6966    /**
  • trunk/test/unit/org/openstreetmap/josm/data/vector/VectorNodeTest.java

    r18477 r18870  
    1414
    1515import org.junit.jupiter.api.Test;
    16 import org.junit.jupiter.api.extension.RegisterExtension;
    1716import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
    1817import org.openstreetmap.josm.data.coor.EastNorth;
     
    2524import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
    2625import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    27 import org.openstreetmap.josm.testutils.JOSMTestRules;
     26import org.openstreetmap.josm.testutils.annotations.Projection;
    2827
    2928/**
     
    3231 * @since 17862
    3332 */
     33@Projection
    3434class VectorNodeTest {
    35     @RegisterExtension
    36     JOSMTestRules rule = new JOSMTestRules().projection();
    37 
    3835    @Test
    3936    void testLatLon() {
  • trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java

    r17275 r18870  
    88import java.awt.Color;
    99
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.junit.jupiter.api.Test;
    1211import org.openstreetmap.josm.TestUtils;
     
    1413import org.openstreetmap.josm.gui.MapScaler.AccessibleMapScaler;
    1514import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.Main;
     16import org.openstreetmap.josm.testutils.annotations.Projection;
    1917
    2018/**
    2119 * Unit tests of {@link MapScaler} class.
    2220 */
     21@Main
     22@Projection
    2323class MapScalerTest {
    24 
    25     /**
    26      * Setup tests
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().main().projection();
    31 
    3224    /**
    3325     * Unit test of {@link MapScaler#MapScaler}.
  • trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java

    r18690 r18870  
    99import java.util.function.Function;
    1010
    11 import org.junit.jupiter.api.BeforeAll;
    1211import org.junit.jupiter.api.BeforeEach;
    1312import org.junit.jupiter.api.Test;
    14 import org.openstreetmap.josm.JOSMFixture;
    1513import org.openstreetmap.josm.data.coor.EastNorth;
    1614import org.openstreetmap.josm.data.coor.LatLon;
     
    1816import org.openstreetmap.josm.gui.MapViewState.MapViewPoint;
    1917import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle;
     18import org.openstreetmap.josm.testutils.annotations.Projection;
    2019
    2120/**
     
    2322 * @author Michael Zangl
    2423 */
     24@Projection
    2525class MapViewStateTest {
    2626
     
    2828    private static final int HEIGHT = 200;
    2929    private MapViewState state;
    30 
    31     /**
    32      * Setup test.
    33      */
    34     @BeforeAll
    35     public static void setUpBeforeClass() {
    36         JOSMFixture.createUnitTestFixture().init();
    37     }
    3830
    3931    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java

    r18690 r18870  
    2222import org.junit.jupiter.api.BeforeEach;
    2323import org.junit.jupiter.api.Test;
    24 import org.junit.jupiter.api.extension.RegisterExtension;
    2524import org.openstreetmap.josm.data.Bounds;
    2625import org.openstreetmap.josm.data.ProjectionBounds;
     
    3231import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3332import org.openstreetmap.josm.gui.util.GuiHelper;
    34 import org.openstreetmap.josm.testutils.JOSMTestRules;
    35 
    36 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     33import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     34import org.openstreetmap.josm.testutils.annotations.Projection;
    3735
    3836/**
     
    4139 *
    4240 */
     41@BasicPreferences
     42@Projection // We need the projection for coordinate conversions.
    4343class NavigatableComponentTest {
    4444
     
    6363    private static final int WIDTH = 300;
    6464    private NavigatableComponentMock component;
    65 
    66     /**
    67      * We need the projection for coordinate conversions.
    68      */
    69     @RegisterExtension
    70     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    71     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    7265
    7366    /**
     
    265258    /**
    266259     * Check that EastNorth is the same as expected after zooming the NavigatableComponent.
    267      *
     260     * <p>
    268261     * Adds tolerance of 0.5 pixel for pixel grid alignment, see
    269262     * {@link NavigatableComponent#zoomTo(EastNorth, double, boolean)}
  • trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java

    r18690 r18870  
    1515import javax.swing.table.TableCellRenderer;
    1616
    17 import org.junit.jupiter.api.extension.RegisterExtension;
    1817import org.junit.jupiter.api.Test;
    1918import org.openstreetmap.josm.TestUtils;
    20 import org.openstreetmap.josm.testutils.JOSMTestRules;
     19import org.openstreetmap.josm.testutils.annotations.Main;
    2120import org.openstreetmap.josm.tools.Logging;
    2221import org.openstreetmap.josm.tools.ReflectionUtils;
    23 
    24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2522
    2623/**
     
    2926 * {@link TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
    3027 * java.lang.Object, boolean, boolean, int, int)}.
    31  *
     28 * <p>
    3229 * For unknown reason java sometimes call getTableCellRendererComponent method
    3330 * with value = null. Every implementation of {@code getTableCellRendererComponent}
    3431 * must fail gracefully when null is passed as value parameter.
    35  *
     32 * <p>
    3633 * This test scans the classpath for classes implementing {@code TableCellRenderer},
    3734 * creates an instance and calls {@code getTableCellRendererComponent} with null
     
    4037 * @see <a href="https://josm.openstreetmap.de/ticket/6301">#6301</a>
    4138 */
     39@Main
    4240class TableCellRendererTest {
    4341
     
    4947
    5048    /**
    51      * Setup test.
    52      */
    53     @RegisterExtension
    54     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    55     public JOSMTestRules test = new JOSMTestRules().main();
    56 
    57     /**
    5849     * Unit test of all table cell renderers against null values.
    59      * @throws NoSuchMethodException no default constructor - to fix this, add a default constructor to the class
    60      *                               or add the class to the SKIP_TEST list above
    61      * @throws ReflectiveOperationException if an error occurs
    6250     */
    6351    @Test
    64     void testTableCellRenderer() throws ReflectiveOperationException {
     52    void testTableCellRenderer() {
    6553        Set<Class<? extends TableCellRenderer>> renderers = TestUtils.getJosmSubtypes(TableCellRenderer.class);
    6654        assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java

    r18610 r18870  
    99import java.util.stream.Stream;
    1010
    11 import org.junit.jupiter.api.extension.RegisterExtension;
    1211import org.junit.jupiter.api.Test;
    1312import org.junit.jupiter.params.ParameterizedTest;
     
    2625import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
    2726import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    28 import org.openstreetmap.josm.testutils.JOSMTestRules;
    29 
    30 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     27import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     28import org.openstreetmap.josm.testutils.annotations.Main;
     29import org.openstreetmap.josm.testutils.annotations.Projection;
    3130
    3231/**
    3332 * Unit tests of {@link OsmTransferHandler} class.
    3433 */
     34@BasicPreferences
     35@Main
     36@Projection
    3537class OsmTransferHandlerTest {
    36     /**
    37      * Prefs to use OSM primitives
    38      */
    39     @RegisterExtension
    40     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    41     public JOSMTestRules test = new JOSMTestRules().preferences().projection().main();
    42 
    4338    private final OsmTransferHandler transferHandler = new OsmTransferHandler();
    4439
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java

    r17347 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    87import org.junit.jupiter.api.Test;
    98import org.openstreetmap.josm.TestUtils;
     
    1413import org.openstreetmap.josm.gui.MapFrame;
    1514import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     16import org.openstreetmap.josm.testutils.annotations.Main;
     17import org.openstreetmap.josm.testutils.annotations.Projection;
    1918
    2019/**
    2120 * Unit tests of {@link CommandStackDialog} class.
    2221 */
     22@BasicPreferences
     23@Main
     24@Projection
    2325class CommandStackDialogTest {
    24 
    25     /**
    26      * Setup tests
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
    31 
    3226    /**
    3327     * Unit test of {@link CommandStackDialog} class - empty case.
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/FilterDialogTest.java

    r18571 r18870  
    1212import javax.swing.AbstractAction;
    1313
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.junit.jupiter.params.ParameterizedTest;
    1615import org.junit.jupiter.params.provider.ValueSource;
    1716import org.openstreetmap.josm.data.osm.Filter;
    18 import org.openstreetmap.josm.testutils.JOSMTestRules;
    1917import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     18import org.openstreetmap.josm.testutils.annotations.Main;
    2019import org.openstreetmap.josm.tools.ReflectionUtils;
    2120
     
    2322 * Test class for {@link FilterDialog}
    2423 */
    25 @BasicPreferences
     24@BasicPreferences(true)
     25@Main
    2626class FilterDialogTest {
    2727    private static final List<Filter> FILTERS = Stream.of("type:node", "type:way", "type:relation")
    2828            .map(Filter::readFromString).map(Filter::new).collect(Collectors.toList());
    29 
    30     @RegisterExtension
    31     static JOSMTestRules josmTestRules = new JOSMTestRules().main();
    3229
    3330    @ParameterizedTest
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java

    r18555 r18870  
    1212import org.junit.jupiter.api.BeforeEach;
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.data.SystemOfMeasurement;
    1615import org.openstreetmap.josm.data.coor.LatLon;
     
    2120import org.openstreetmap.josm.gui.MainApplication;
    2221import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    23 import org.openstreetmap.josm.testutils.JOSMTestRules;
    24 
    25 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     22import org.openstreetmap.josm.testutils.annotations.Main;
     23import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
     24import org.openstreetmap.josm.testutils.annotations.Projection;
    2625
    2726/**
    2827 * Unit tests of {@link InspectPrimitiveDialog} class.
    2928 */
     29@Main
     30@MapPaintStyles
     31@Projection
    3032class InspectPrimitiveDialogTest {
    31 
    32     /**
    33      * Setup tests
    34      */
    35     @RegisterExtension
    36     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    37     static JOSMTestRules test = new JOSMTestRules().main().projection().mapStyles();
    38 
    3933    /**
    4034     * Setup test
     
    4337    public void setUp() {
    4438        SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.put("METRIC");
    45 
    4639    }
    4740
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java

    r17275 r18870  
    22package org.openstreetmap.josm.gui.dialogs;
    33
    4 import org.junit.jupiter.api.extension.RegisterExtension;
    54import org.junit.jupiter.api.Test;
    65import org.openstreetmap.josm.data.osm.DataSet;
    76import org.openstreetmap.josm.gui.MainApplication;
    87import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    9 import org.openstreetmap.josm.testutils.JOSMTestRules;
    10 
    11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     8import org.openstreetmap.josm.testutils.annotations.Main;
     9import org.openstreetmap.josm.testutils.annotations.Projection;
    1210
    1311/**
    1412 * Unit tests of {@link MapPaintDialog} class.
    1513 */
     14@Main
     15@Projection
    1616class MapPaintDialogTest {
    17 
    18     /**
    19      * Setup tests
    20      */
    21     @RegisterExtension
    22     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().main().projection();
    24 
    2517    /**
    2618     * Unit test of {@link MapPaintDialog.InfoAction} class.
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java

    r18839 r18870  
    1818
    1919import org.junit.jupiter.api.Test;
    20 import org.junit.jupiter.api.extension.RegisterExtension;
    2120import org.junit.jupiter.params.ParameterizedTest;
    2221import org.junit.jupiter.params.provider.Arguments;
     
    3635import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3736import org.openstreetmap.josm.spi.preferences.Config;
    38 import org.openstreetmap.josm.testutils.JOSMTestRules;
    3937import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     38import org.openstreetmap.josm.testutils.annotations.Main;
     39import org.openstreetmap.josm.testutils.annotations.Projection;
    4040import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
    4141
     
    4444 */
    4545@BasicPreferences
     46/* Only needed for {@link #testTicket21558} */
     47@Main
     48@Projection
    4649class NotesDialogTest {
    47     /** Only needed for {@link #testTicket21558} */
    48     @RegisterExtension
    49     JOSMTestRules rules = new JOSMTestRules().main().projection();
    5050    private Note createMultiLineNote() {
    5151        Note note = new Note(LatLon.ZERO);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java

    r18037 r18870  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    33
    4 import static org.junit.jupiter.api.Assertions.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    55
    6 import org.openstreetmap.josm.testutils.JOSMTestRules;
    7 
    8 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    96import org.junit.jupiter.api.Test;
    10 import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     8import org.openstreetmap.josm.testutils.annotations.Main;
    119
    1210/**
    1311 * Unit tests of {@link ChangesetContentPanel} class.
    1412 */
     13@BasicPreferences
     14@Main
    1515class ChangesetContentPanelTest {
    16 
    17     /**
    18      * Setup tests
    19      */
    20     @RegisterExtension
    21     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules().preferences().main();
    23 
    2416    /**
    2517     * Unit test of {@link ChangesetContentPanel#ChangesetContentPanel}.
     
    2719    @Test
    2820    void testChangesetContentPanel() {
    29         assertNotNull(new ChangesetContentPanel());
     21        assertDoesNotThrow(ChangesetContentPanel::new);
    3022    }
    3123}
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java

    r18018 r18870  
    77
    88import org.junit.jupiter.api.Test;
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.openstreetmap.josm.gui.MainApplication;
    1110import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     
    1413import org.openstreetmap.josm.gui.layer.TMSLayer;
    1514import org.openstreetmap.josm.gui.layer.TMSLayerTest;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     16import org.openstreetmap.josm.testutils.annotations.Main;
     17import org.openstreetmap.josm.testutils.annotations.Projection;
    1918
    2019/**
    2120 * Unit tests of {@link LayerVisibilityAction} class.
    2221 */
     22@BasicPreferences
     23@Main
     24@Projection
    2325class LayerVisibilityActionTest {
    24     /**
    25      * TMS layer needs prefs. Platform for LayerListDialog shortcuts.
    26      */
    27     @RegisterExtension
    28     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().preferences().projection().main();
    30 
    3126    /**
    3227     * Unit test of {@link LayerVisibilityAction} class.
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java

    r17275 r18870  
    1010import javax.swing.table.DefaultTableModel;
    1111
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1312import org.junit.jupiter.api.Test;
    14 import org.openstreetmap.josm.testutils.JOSMTestRules;
    15 
    16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     13import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1714
    1815/**
    1916 * Unit tests of {@link PropertiesCellRenderer} class.
    2017 */
     18@BasicPreferences
    2119class PropertiesCellRendererTest {
    22 
    23     /**
    24      * Setup test.
    25      */
    26     @RegisterExtension
    27     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().preferences();
    29 
    3020    /**
    3121     * Test of color rendering.
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java

    r18586 r18870  
    1313
    1414import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    1615import org.junit.jupiter.params.ParameterizedTest;
    1716import org.junit.jupiter.params.provider.Arguments;
     
    2625import org.openstreetmap.josm.gui.PrimitiveHoverListener;
    2726import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    28 import org.openstreetmap.josm.testutils.JOSMTestRules;
    2927import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     28import org.openstreetmap.josm.testutils.annotations.Main;
     29import org.openstreetmap.josm.testutils.annotations.Projection;
    3030import org.openstreetmap.josm.tools.ReflectionUtils;
    3131
     
    3333 * Unit tests of {@link PropertiesDialog} class.
    3434 */
    35 @BasicPreferences
     35@BasicPreferences(true)
     36@Main
     37@Projection
    3638class PropertiesDialogTest {
    37     @RegisterExtension
    38     static JOSMTestRules rules = new JOSMTestRules().main().projection();
    3939
    4040    private static String createSearchSetting(List<OsmPrimitive> sel, boolean sameType) {
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java

    r17275 r18870  
    88import org.junit.jupiter.api.BeforeEach;
    99import org.junit.jupiter.api.Disabled;
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.openstreetmap.josm.data.osm.DataSet;
    1211import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2322import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
    2423import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetHandler;
    25 import org.openstreetmap.josm.testutils.JOSMTestRules;
    26 
    27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     24import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     25import org.openstreetmap.josm.testutils.annotations.Main;
    2826
    2927/**
     
    3230 */
    3331@Disabled
     32@BasicPreferences
     33@Main
    3434public abstract class AbstractRelationEditorActionTest {
    35     /**
    36      * Platform for tooltips.
    37      */
    38     @RegisterExtension
    39     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    40     public JOSMTestRules test = new JOSMTestRules().preferences().main();
    41 
    4235    protected OsmDataLayer layer;
    4336
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java

    r18690 r18870  
    1313import org.junit.jupiter.api.BeforeEach;
    1414import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    1615import org.openstreetmap.josm.data.osm.DataSet;
    1716import org.openstreetmap.josm.data.osm.Relation;
     
    2019import org.openstreetmap.josm.io.IllegalDataException;
    2120import org.openstreetmap.josm.io.OsmReader;
    22 import org.openstreetmap.josm.testutils.JOSMTestRules;
    23 
    24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     21import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     22import org.openstreetmap.josm.testutils.annotations.Projection;
    2523
    2624/**
    2725 * Unit tests of {@link RelationSorter} class.
    2826 */
     27@BasicPreferences
     28@Projection
    2929class RelationSorterTest {
    3030
    3131    private final RelationSorter sorter = new RelationSorter();
    3232    private DataSet testDataset;
    33 
    34     /**
    35      * Use Mercator projection
    36      */
    37     @RegisterExtension
    38     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    39     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    4033
    4134    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java

    r18690 r18870  
    1818import org.junit.jupiter.api.BeforeEach;
    1919import org.junit.jupiter.api.Test;
    20 import org.junit.jupiter.api.extension.RegisterExtension;
    2120import org.openstreetmap.josm.data.osm.DataSet;
    2221import org.openstreetmap.josm.data.osm.Node;
     
    2726import org.openstreetmap.josm.io.IllegalDataException;
    2827import org.openstreetmap.josm.io.OsmReader;
    29 import org.openstreetmap.josm.testutils.JOSMTestRules;
    30 
    31 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     28import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     29import org.openstreetmap.josm.testutils.annotations.Projection;
    3230
    3331/**
    3432 * Unit tests of {@link WayConnectionTypeCalculator} class.
    3533 */
     34@BasicPreferences
     35@Projection
    3636class WayConnectionTypeCalculatorTest {
    3737
     
    3939    private final WayConnectionTypeCalculator wayConnectionTypeCalculator = new WayConnectionTypeCalculator();
    4040    private DataSet testDataset;
    41 
    42     /**
    43      * Use Mercator projection
    44      */
    45     @RegisterExtension
    46     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    47     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    4841
    4942    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java

    r17275 r18870  
    66
    77import org.junit.jupiter.api.Test;
    8 import org.junit.jupiter.api.extension.RegisterExtension;
    9 import org.openstreetmap.josm.testutils.JOSMTestRules;
    10 
    11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     8import org.junit.jupiter.api.Timeout;
    129
    1310/**
    1411 * Unit tests of {@link HelpContentReader} class.
    1512 */
     13@Timeout(30)
    1614class HelpContentReaderTest {
    17 
    18     /**
    19      * Setup tests
    20      */
    21     @RegisterExtension
    22     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().timeout(30000);
    24 
    2515    /**
    2616     * Unit test of {@link HelpContentReader#fetchHelpTopicContent} - null case.
  • trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java

    r17890 r18870  
    88import static org.junit.jupiter.api.Assertions.assertTrue;
    99
    10 import org.junit.jupiter.api.extension.RegisterExtension;
     10import java.awt.Color;
     11
    1112import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.Timeout;
    1214import org.openstreetmap.josm.data.osm.Node;
    1315import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    1719import org.openstreetmap.josm.data.osm.history.HistoryDataSet;
    1820import org.openstreetmap.josm.data.osm.history.HistoryNode;
    19 import org.openstreetmap.josm.testutils.JOSMTestRules;
    20 
    21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    22 
    23 import java.awt.Color;
     21import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     22import org.openstreetmap.josm.testutils.annotations.OsmApi;
    2423
    2524/**
    2625 * Unit tests of {@link HistoryBrowserModel} class.
    2726 */
     27@BasicPreferences
     28@OsmApi(OsmApi.APIType.DEV)
     29@Timeout(30)
    2830class HistoryBrowserModelTest {
    29 
    30     /**
    31      * Setup test.
    32      */
    33     @RegisterExtension
    34     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(30000);
    36 
    3731    /**
    3832     * Test for {@link HistoryBrowserModel#HistoryBrowserModel}.
  • trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java

    r18690 r18870  
    77import java.io.InputStream;
    88
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.Timeout;
    1111import org.openstreetmap.josm.TestUtils;
    1212import org.openstreetmap.josm.data.osm.Node;
     
    2222import org.openstreetmap.josm.io.OsmServerHistoryReader;
    2323import org.openstreetmap.josm.io.OsmTransferException;
    24 import org.openstreetmap.josm.testutils.JOSMTestRules;
     24import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     25import org.openstreetmap.josm.testutils.annotations.OsmApi;
    2526import org.xml.sax.SAXException;
    26 
    27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2827
    2928/**
    3029 * Unit tests of {@link HistoryLoadTask} class.
    3130 */
     31@BasicPreferences
     32@OsmApi(OsmApi.APIType.DEV)
     33@Timeout(20)
    3234class HistoryLoadTaskTest {
    33 
    34     /**
    35      * Setup test.
    36      */
    37     @RegisterExtension
    38     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    39     public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000);
    40 
    4135    /**
    4236     * Unit test of {@link HistoryLoadTask#getLoadingMessage}
  • trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java

    r18690 r18870  
    1313import org.junit.jupiter.api.BeforeEach;
    1414import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    1615import org.openstreetmap.josm.TestUtils;
    1716import org.openstreetmap.josm.data.APIDataSet;
     
    2322import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2423import org.openstreetmap.josm.io.UploadStrategySpecification;
    25 import org.openstreetmap.josm.testutils.JOSMTestRules;
     24import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
    2625import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    27 
    28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2926
    3027/**
    3128 * Unit tests of {@link AsynchronousUploadPrimitivesTask}.
    3229 */
     30@AssertionsInEDT
    3331class AsynchronousUploadPrimitivesTaskTest {
    3432
     
    3836    private Changeset changeset;
    3937    private AsynchronousUploadPrimitivesTask uploadPrimitivesTask;
    40 
    41     /**
    42      * Setup tests
    43      */
    44     @RegisterExtension
    45     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    46     public JOSMTestRules test = new JOSMTestRules().assertionsInEDT();
    4738
    4839    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java

    r18650 r18870  
    1515
    1616import org.junit.jupiter.api.BeforeEach;
    17 import org.junit.jupiter.api.extension.RegisterExtension;
    1817import org.junit.jupiter.api.Test;
    1918import org.openstreetmap.josm.TestUtils;
     
    2120import org.openstreetmap.josm.gui.oauth.OAuthAuthorizationWizard;
    2221import org.openstreetmap.josm.spi.preferences.Config;
    23 import org.openstreetmap.josm.testutils.JOSMTestRules;
     22import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     23import org.openstreetmap.josm.testutils.annotations.OsmApi;
    2424import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    2525import org.openstreetmap.josm.testutils.mockers.WindowMocker;
    2626import org.openstreetmap.josm.tools.UserCancelException;
    2727
    28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2928import mockit.Invocation;
    3029import mockit.Mock;
     
    3433 * Unit tests of {@link DownloadOpenChangesetsTask} class.
    3534 */
     35@BasicPreferences
     36@OsmApi(OsmApi.APIType.DEV)
    3637class DownloadOpenChangesetsTaskTest {
    37 
    38     /**
    39      * Setup tests
    40      */
    41     @RegisterExtension
    42     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    43     public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();
    44 
    4538    /**
    4639     * OAuth wizard mocker.
  • trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java

    r17275 r18870  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import java.util.Arrays;
     8import java.util.Collections;
    99
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.Timeout;
    1212import org.openstreetmap.josm.data.osm.DataSet;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1414import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
    1515import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     16import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     17import org.openstreetmap.josm.testutils.annotations.OsmApi;
    1918
    2019/**
    2120 * Unit tests of {@link DownloadPrimitivesTask} class.
    2221 */
     22@BasicPreferences
     23@OsmApi(OsmApi.APIType.DEV)
     24@Timeout(20)
    2325class DownloadPrimitivesTaskTest {
    24 
    25     /**
    26      * Setup tests
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000);
    31 
    3226    /**
    3327     * Test of {@link DownloadPrimitivesTask} class.
     
    3832        assertTrue(ds.allPrimitives().isEmpty());
    3933        SimplePrimitiveId pid = new SimplePrimitiveId(1, OsmPrimitiveType.NODE);
    40         new DownloadPrimitivesTask(new OsmDataLayer(ds, "", null), Arrays.asList(pid), true).run();
     34        new DownloadPrimitivesTask(new OsmDataLayer(ds, "", null), Collections.singletonList(pid), true).run();
    4135        assertFalse(ds.allPrimitives().isEmpty());
    4236        assertNotNull(ds.getPrimitiveById(pid));
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java

    r17275 r18870  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.jupiter.api.extension.RegisterExtension;
    76import org.junit.jupiter.api.Test;
    87import org.openstreetmap.josm.io.UploadStrategy;
    98import org.openstreetmap.josm.io.UploadStrategySpecification;
    10 import org.openstreetmap.josm.testutils.JOSMTestRules;
    11 
    12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     9import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     10import org.openstreetmap.josm.testutils.annotations.OsmApi;
    1311
    1412/**
    1513 * Unit tests of {@link UploadStrategySelectionPanel} class.
    1614 */
     15@BasicPreferences
     16@OsmApi(OsmApi.APIType.DEV)
    1717class UploadStrategySelectionPanelTest {
    18 
    19     /**
    20      * Setup tests
    21      */
    22     @RegisterExtension
    23     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    24     public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();
    25 
    2618    /**
    2719     * Test of {@link UploadStrategySelectionPanel#UploadStrategySelectionPanel}.
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java

    r17275 r18870  
    22package org.openstreetmap.josm.gui.layer;
    33
     4import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    45import static org.junit.jupiter.api.Assertions.assertEquals;
    56import static org.junit.jupiter.api.Assertions.assertFalse;
     
    1415import org.junit.jupiter.api.BeforeEach;
    1516import org.junit.jupiter.api.Test;
    16 import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.gui.jmapviewer.Coordinate;
    1818import org.openstreetmap.gui.jmapviewer.Projected;
     
    3232import org.openstreetmap.josm.gui.MainApplication;
    3333import org.openstreetmap.josm.gui.layer.imagery.ImageryFilterSettings;
    34 import org.openstreetmap.josm.testutils.JOSMTestRules;
    35 
    36 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     34import org.openstreetmap.josm.testutils.annotations.Main;
     35import org.openstreetmap.josm.testutils.annotations.Projection;
    3736
    3837/**
    3938 * Test of the base {@link AbstractTileSourceLayer} class
    4039 */
     40@Projection
     41@Main
    4142class AbstractTileSourceLayerTest {
    42 
    43     /**
    44      * Setup test
    45      */
    46     @RegisterExtension
    47     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    48     public JOSMTestRules test = new JOSMTestRules().projection().main();
    49 
    5043    private static final class TMSTileStubSource extends AbstractTMSTileSource {
    5144        private TMSTileStubSource() {
     
    203196    @Test
    204197    void testTileSourceLayerPopup() {
    205         assertNotNull(testLayer.new TileSourceLayerPopup(100, 100));
     198        assertDoesNotThrow(() -> testLayer.new TileSourceLayerPopup(100, 100));
    206199    }
    207200}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java

    r17841 r18870  
    2323import org.junit.jupiter.api.BeforeEach;
    2424import org.junit.jupiter.api.Test;
    25 import org.junit.jupiter.api.extension.RegisterExtension;
    2625import org.openstreetmap.josm.data.coor.LatLon;
    2726import org.openstreetmap.josm.data.osm.DataSet;
     
    2928import org.openstreetmap.josm.gui.MainApplication;
    3029import org.openstreetmap.josm.gui.layer.AutosaveTask.AutosaveLayerInfo;
    31 import org.openstreetmap.josm.testutils.JOSMTestRules;
    32 
    33 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     30import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     31import org.openstreetmap.josm.testutils.annotations.Projection;
    3432
    3533/**
    3634 * Unit tests for class {@link AutosaveTask}.
    3735 */
     36/* We need preferences and a home directory for this. */
     37@BasicPreferences
     38@Projection
    3839class AutosaveTaskTest {
    39     /**
    40      * We need preferences and a home directory for this.
    41      */
    42     @RegisterExtension
    43     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    44     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    45 
    4640    private AutosaveTask task;
    4741
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java

    r17275 r18870  
    1212import org.junit.jupiter.api.BeforeEach;
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     16import org.openstreetmap.josm.testutils.annotations.Projection;
    1917
    2018/**
     
    2220 * @author Michael Zangl
    2321 */
     22@BasicPreferences
     23/* We need projection */
     24@Projection
    2425class LayerTest {
    25     /**
    26      * We need projection
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    31 
    3226    private Layer testLayer;
    3327
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r18753 r18870  
    1616import org.junit.jupiter.api.BeforeEach;
    1717import org.junit.jupiter.api.Test;
    18 import org.junit.jupiter.api.extension.RegisterExtension;
    1918import org.openstreetmap.josm.TestUtils;
    2019import org.openstreetmap.josm.actions.ExpertToggleAction;
     
    3534import org.openstreetmap.josm.io.IllegalDataException;
    3635import org.openstreetmap.josm.io.OsmReader;
    37 import org.openstreetmap.josm.testutils.JOSMTestRules;
     36import org.openstreetmap.josm.testutils.annotations.Main;
     37import org.openstreetmap.josm.testutils.annotations.Projection;
    3838import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
    3939import org.openstreetmap.josm.tools.Logging;
    40 
    41 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    4240
    4341/**
    4442 * Unit tests of {@link OsmDataLayer} class.
    4543 */
     44@Main
     45@Projection
    4646class OsmDataLayerTest {
    47 
    48     /**
    49      * Setup tests
    50      */
    51     @RegisterExtension
    52     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    53     public JOSMTestRules test = new JOSMTestRules().projection().main();
    54 
    5547    private DataSet ds;
    5648    private OsmDataLayer layer;
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java

    r17275 r18870  
    55
    66import org.junit.jupiter.api.Test;
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    87import org.openstreetmap.josm.data.imagery.ImageryInfo;
    98import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
    109import org.openstreetmap.josm.gui.MainApplication;
    11 import org.openstreetmap.josm.testutils.JOSMTestRules;
    12 
    13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     10import org.openstreetmap.josm.testutils.annotations.Main;
     11import org.openstreetmap.josm.testutils.annotations.Projection;
    1412
    1513/**
    1614 * Unit tests of {@link TMSLayer} class.
    1715 */
     16@Main
     17@Projection
    1818public class TMSLayerTest {
    19 
    20     /**
    21      * Setup tests
    22      */
    23     @RegisterExtension
    24     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    25     public JOSMTestRules test = new JOSMTestRules().main().projection();
    26 
    2719    /**
    2820     * Creates a new TMS layer.
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java

    r17275 r18870  
    77import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.junit.jupiter.api.Test;
    1110import org.openstreetmap.josm.data.osm.DataSet;
    1211import org.openstreetmap.josm.gui.MainApplication;
    13 import org.openstreetmap.josm.testutils.JOSMTestRules;
    14 
    15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     12import org.openstreetmap.josm.testutils.annotations.Main;
     13import org.openstreetmap.josm.testutils.annotations.Projection;
    1614
    1715/**
    1816 * Unit tests of {@link ValidatorLayer} class.
    1917 */
     18@Main
     19@Projection
    2020class ValidatorLayerTest {
    21 
    22     /**
    23      * Setup tests
    24      */
    25     @RegisterExtension
    26     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    27     public JOSMTestRules test = new JOSMTestRules().projection().main();
    28 
    2921    /**
    3022     * Unit test of {@link ValidatorLayer#ValidatorLayer}.
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java

    r17275 r18870  
    66
    77import org.junit.jupiter.api.Test;
    8 import org.junit.jupiter.api.extension.RegisterExtension;
    98import org.openstreetmap.josm.data.imagery.ImageryInfo;
    109import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
    1110import org.openstreetmap.josm.gui.MainApplication;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
    13 
    14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     11import org.openstreetmap.josm.testutils.annotations.Main;
     12import org.openstreetmap.josm.testutils.annotations.Projection;
    1513
    1614/**
    1715 * Unit tests of {@link WMSLayer} class.
    1816 */
     17@Main
     18@Projection
    1919class WMSLayerTest {
    20 
    21     /**
    22      * Setup tests
    23      */
    24     @RegisterExtension
    25     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules test = new JOSMTestRules().main().projection();
    27 
    2820    /**
    2921     * Unit test of {@link WMSLayer#WMSLayer}.
     
    4638    @Test
    4739    void testTicket13828() {
    48         assertThrows(IllegalArgumentException.class, () -> new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png")));
     40        final ImageryInfo info = new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png");
     41        assertThrows(IllegalArgumentException.class, () -> new WMSLayer(info));
    4942    }
    5043}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java

    r17275 r18870  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.jupiter.api.extension.RegisterExtension;
    76import org.junit.jupiter.api.Test;
     7import org.junit.jupiter.api.Timeout;
    88import org.openstreetmap.josm.data.imagery.ImageryInfo;
    99import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
    10 import org.openstreetmap.josm.testutils.JOSMTestRules;
    11 
    12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     10import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1311
    1412/**
    1513 * Unit tests of {@link WMTSLayer} class.
    1614 */
     15@BasicPreferences
     16@Timeout(20)
    1717class WMTSLayerTest {
    18 
    19     /**
    20      * Setup tests
    21      */
    22     @RegisterExtension
    23     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    24     public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000);
    25 
    2618    /**
    2719     * Unit test of {@link WMTSLayer#WMTSLayer}.
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java

    r18614 r18870  
    66import java.util.Collections;
    77
    8 import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.data.osm.DataSet;
    1010import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    11 import org.openstreetmap.josm.testutils.JOSMTestRules;
    1211import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    13 
    14 import org.junit.jupiter.api.Test;
     12import org.openstreetmap.josm.testutils.annotations.Main;
    1513
    1614/**
     
    1917// Basic preferences are needed for OSM primitives
    2018@BasicPreferences
     19@Main
    2120class GeoImageLayerTest {
    22     @RegisterExtension
    23     static JOSMTestRules josmTestRules = new JOSMTestRules().main();
    24 
    2521    /**
    2622     * Test that {@link GeoImageLayer#mergeFrom} throws IAE for invalid arguments
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoaderTest.java

    r18689 r18870  
    1111
    1212import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.extension.RegisterExtension;
    1413import org.openstreetmap.josm.TestUtils;
    1514import org.openstreetmap.josm.gui.MainApplication;
    1615import org.openstreetmap.josm.gui.layer.GpxLayer;
    1716import org.openstreetmap.josm.io.GpxReader;
    18 import org.openstreetmap.josm.testutils.JOSMTestRules;
    19 
    20 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     17import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2118
    2219/**
    2320 * Unit tests of {@link ImagesLoader} class.
    2421 */
     22@BasicPreferences
    2523class ImagesLoaderTest {
    26 
    27     /**
    28      * We need prefs for this.
    29      */
    30     @RegisterExtension
    31     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    32     public JOSMTestRules test = new JOSMTestRules().preferences();
    33 
    3424    /**
    3525     * Unit test of {@link ImagesLoader} class.
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/MVTLayerTest.java

    r18191 r18870  
    1616import org.junit.jupiter.api.BeforeEach;
    1717import org.junit.jupiter.api.Test;
    18 import org.junit.jupiter.api.extension.RegisterExtension;
    1918import org.junit.jupiter.params.ParameterizedTest;
    2019import org.junit.jupiter.params.provider.ValueSource;
     
    3433import org.openstreetmap.josm.gui.MainApplication;
    3534import org.openstreetmap.josm.testutils.FakeGraphics;
    36 import org.openstreetmap.josm.testutils.JOSMTestRules;
    3735import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     36import org.openstreetmap.josm.testutils.annotations.HTTP;
     37import org.openstreetmap.josm.testutils.annotations.Main;
    3838
    3939/**
     
    4141 */
    4242@BasicPreferences
     43@HTTP
     44@Main
     45@org.openstreetmap.josm.testutils.annotations.Projection
    4346class MVTLayerTest {
    44     // Needed for setting HTTP factory and the main window/mapview
    45     @RegisterExtension
    46     JOSMTestRules josmTestRules = new JOSMTestRules().main().projection();
    47 
    4847    MVTLayer testLayer;
    4948
     
    5655
    5756    @Test
    58     void getTileLoaderClass() {
     57    void testGetTileLoaderClass() {
    5958        assertEquals(MapboxVectorCachedTileLoader.class, this.testLayer.getTileLoaderClass());
    6059    }
    6160
    6261    @Test
    63     void getCacheName() {
     62    void testGetCacheName() {
    6463        assertEquals("MVT", this.testLayer.getCacheName());
    6564    }
    6665
    6766    @Test
    68     void getCache() {
     67    void testGetCache() {
    6968        assertNotNull(MVTLayer.getCache());
    7069    }
    7170
    7271    @Test
    73     void getNativeProjections() {
     72    void testGetNativeProjections() {
    7473        assertArrayEquals(Collections.singleton(MVTFile.DEFAULT_PROJECTION).toArray(), this.testLayer.getNativeProjections().toArray());
    7574    }
     
    8281    @ParameterizedTest
    8382    @ValueSource(strings = {"EPSG:3857" /* WGS 84 */, "EPSG:4326" /* Mercator (default) */, "EPSG:32612" /* UTM 12 N */})
    84     void ensureDifferentProjectionsAreFetched(final String projectionCode) throws ReflectiveOperationException {
     83    void testEnsureDifferentProjectionsAreFetched(final String projectionCode) throws ReflectiveOperationException {
    8584        final Projection originalProjection = ProjectionRegistry.getProjection();
    8685        try {
     
    104103
    105104    @Test
    106     void getTileSource() {
     105    void testGetTileSource() {
    107106        assertEquals(this.testLayer.getInfo().getUrl(), this.testLayer.getTileSource().getBaseUrl());
    108107    }
    109108
    110109    @Test
    111     void createTile() {
     110    void testCreateTile() {
    112111        assertNotNull(this.testLayer.createTile(this.testLayer.getTileSource(), 3251, 6258, 14));
    113112    }
     
    115114    @ParameterizedTest
    116115    @ValueSource(booleans = {true, false})
    117     void getMenuEntries(final boolean isExpert) {
     116    void testGetMenuEntries(final boolean isExpert) {
    118117        ExpertToggleAction.getInstance().setExpert(isExpert);
    119118        // For now, just ensure that nothing throws on implementation
     
    123122
    124123    @Test
    125     void getData() {
     124    void testGetData() {
    126125        assertNotNull(this.testLayer.getData());
    127126    }
    128127
    129128    @Test
    130     void finishedLoading() throws ReflectiveOperationException {
     129    void testFinishedLoading() throws ReflectiveOperationException {
    131130        final MVTTile mvtTile = (MVTTile) this.testLayer.createTile(this.testLayer.getTileSource(), 3248, 6258, 14);
    132131        final FinishedLoading finishedLoading = new FinishedLoading();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java

    r18634 r18870  
    99
    1010import org.junit.jupiter.api.Test;
    11 import org.junit.jupiter.api.extension.RegisterExtension;
    1211import org.openstreetmap.josm.TestUtils;
    1312import org.openstreetmap.josm.data.coor.LatLon;
    1413import org.openstreetmap.josm.data.gpx.GpxData;
    1514import org.openstreetmap.josm.data.gpx.WayPoint;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    1715import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     16import org.openstreetmap.josm.testutils.annotations.Main;
    1817
    1918/**
     
    2120 */
    2221@BasicPreferences
     22@Main
    2323class ImageMarkerTest {
    24     @RegisterExtension
    25     static JOSMTestRules josmTestRules = new JOSMTestRules().main();
    26 
    2724    /**
    2825     * Unit test of {@link ImageMarker#ImageMarker}.
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java

    r17275 r18870  
    77import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    9 import java.util.Arrays;
     9import java.util.Collections;
    1010
    1111import org.junit.jupiter.api.BeforeEach;
    1212import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.extension.RegisterExtension;
    1413import org.openstreetmap.josm.data.coor.LatLon;
    1514import org.openstreetmap.josm.data.gpx.GpxConstants;
     
    2221import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2322import org.openstreetmap.josm.spi.preferences.Config;
    24 import org.openstreetmap.josm.testutils.JOSMTestRules;
    25 
    26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     23import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     24import org.openstreetmap.josm.testutils.annotations.Main;
     25import org.openstreetmap.josm.testutils.annotations.Projection;
    2726
    2827/**
    2928 * Unit tests of {@link MarkerLayer} class.
    3029 */
     30@BasicPreferences
     31@Main
     32@Projection
    3133class MarkerLayerTest {
    32 
    33     /**
    34      * For creating layers
    35      */
    36     @RegisterExtension
    37     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    38     public JOSMTestRules test = new JOSMTestRules().main().preferences().projection();
    39 
    4034    /**
    4135     * Setup tests
     
    6357        GpxData gpx = new GpxData();
    6458        WayPoint wpt = new WayPoint(LatLon.ZERO);
    65         wpt.attr.put(GpxConstants.META_LINKS, Arrays.asList(new GpxLink("https://josm.openstreetmap.de")));
     59        wpt.attr.put(GpxConstants.META_LINKS, Collections.singletonList(new GpxLink("https://josm.openstreetmap.de")));
    6660        wpt.getExtensions().add("josm", "offset", "1.0");
    6761        gpx.waypoints.add(wpt);
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java

    r17275 r18870  
    1313import org.junit.jupiter.api.Disabled;
    1414import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    1615import org.openstreetmap.josm.data.coor.LatLon;
    1716import org.openstreetmap.josm.data.osm.DataSet;
     
    2524import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector;
    2625import org.openstreetmap.josm.io.OsmReader;
    27 import org.openstreetmap.josm.testutils.JOSMTestRules;
    28 
    29 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     26import org.openstreetmap.josm.testutils.annotations.Projection;
    3027
    3128/**
    3229 * Unit tests of {@link ChildOrParentSelector}.
    3330 */
     31@Projection
    3432class ChildOrParentSelectorTest {
    3533
    3634    private DataSet ds;
    37 
    38     /**
    39      * Setup rule
    40      */
    41     @RegisterExtension
    42     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    43     public JOSMTestRules test = new JOSMTestRules().projection();
    4435
    4536    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java

    r18829 r18870  
    3333import org.openstreetmap.josm.spi.preferences.Config;
    3434import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     35import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
    3536import org.openstreetmap.josm.testutils.annotations.Projection;
    3637
     
    172173     * Unit test of {@link Functions#JOSM_pref}, color handling
    173174     */
     175    @MapPaintStyles
    174176    @Test
    175177    void testPrefColor() {
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java

    r18451 r18870  
    1717import org.junit.jupiter.api.BeforeEach;
    1818import org.junit.jupiter.api.Test;
    19 import org.junit.jupiter.api.extension.RegisterExtension;
    2019import org.junit.jupiter.params.ParameterizedTest;
    2120import org.junit.jupiter.params.provider.EnumSource;
     
    3231import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyCondition;
    3332import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType;
    34 import org.openstreetmap.josm.testutils.JOSMTestRules;
     33import org.openstreetmap.josm.testutils.annotations.Projection;
    3534import org.openstreetmap.josm.tools.Logging;
    36 
    37 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3835
    3936/**
    4037 * Unit tests of {@link KeyCondition}.
    4138 */
     39@Projection
    4240class KeyConditionTest {
    4341
    4442    private DataSet ds;
    45 
    46     /**
    47      * Setup rule
    48      */
    49     @RegisterExtension
    50     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    51     public JOSMTestRules test = new JOSMTestRules().projection();
    5243
    5344    /**
     
    166157     * If this fails, and the key should not be fully matched against (i.e., it is a regex), please modify
    167158     * {@link MapCSSRuleIndex#findAnyRequiredKey}.
    168      *
     159     * <p>
    169160     * Non-regression test for JOSM #22073.
    170161     */
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java

    r17275 r18870  
    1010import org.junit.jupiter.api.BeforeEach;
    1111import org.junit.jupiter.api.Test;
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1312import org.openstreetmap.josm.data.coor.LatLon;
    1413import org.openstreetmap.josm.data.osm.DataSet;
     
    2221import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
    2322import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser;
    24 import org.openstreetmap.josm.testutils.JOSMTestRules;
     23import org.openstreetmap.josm.testutils.annotations.Projection;
    2524import org.openstreetmap.josm.tools.Logging;
    26 
    27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2825
    2926/**
    3027 * Unit tests of {@link KeyValueCondition}.
    3128 */
     29@Projection
    3230class KeyValueConditionTest {
    3331
    3432    private DataSet ds;
    35 
    36     /**
    37      * Setup rule
    38      */
    39     @RegisterExtension
    40     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    41     public JOSMTestRules test = new JOSMTestRules().projection();
    4233
    4334    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java

    r18690 r18870  
    1818
    1919import org.junit.jupiter.api.Test;
    20 import org.junit.jupiter.api.extension.RegisterExtension;
    2120import org.junit.jupiter.params.ParameterizedTest;
    2221import org.junit.jupiter.params.provider.ValueSource;
     
    4342import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser;
    4443import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
    45 import org.openstreetmap.josm.testutils.JOSMTestRules;
     44import org.openstreetmap.josm.testutils.annotations.Projection;
    4645import org.openstreetmap.josm.tools.ColorHelper;
    47 
    48 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    4946
    5047/**
    5148 * Unit tests of {@link MapCSSParser}.
    5249 */
     50@Projection
    5351class MapCSSParserTest {
    5452
     
    6058        return new MapCSSParser(new StringReader(stringToParse));
    6159    }
    62 
    63     /**
    64      * Setup rule
    65      */
    66     @RegisterExtension
    67     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    68     public JOSMTestRules test = new JOSMTestRules().projection();
    6960
    7061    @Test
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java

    r17275 r18870  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.jupiter.api.extension.RegisterExtension;
    76import org.junit.jupiter.api.Test;
    8 import org.openstreetmap.josm.testutils.JOSMTestRules;
    9 
    10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     7import org.openstreetmap.josm.testutils.annotations.Projection;
    118
    129/**
    1310 * Unit tests of {@code ParsingLinkSelector}.
    1411 */
     12@Projection
    1513class ParsingLinkSelectorTest {
    16 
    17     /**
    18      * Setup rule
    19      */
    20     @RegisterExtension
    21     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules().projection();
    23 
    2414    @Test
    25     public void parseEmptyChildSelector() {
     15    void testParseEmptyChildSelector() {
    2616        String css = "relation > way {}";
    2717        MapCSSStyleSource source = new MapCSSStyleSource(css);
     
    3121
    3222    @Test
    33     public void parseEmptyParentSelector() {
     23    void testParseEmptyParentSelector() {
    3424        String css = "way < relation {}";
    3525        MapCSSStyleSource source = new MapCSSStyleSource(css);
     
    3929
    4030    @Test
    41     public void parseChildSelectorWithKeyValueCondition() {
     31    void testParseChildSelectorWithKeyValueCondition() {
    4232        String css = "relation >[role=\"my_role\"] way {}";
    4333        MapCSSStyleSource source = new MapCSSStyleSource(css);
     
    4737
    4838    @Test
    49     public void parseChildSelectorWithKeyCondition() {
     39    void testParseChildSelectorWithKeyCondition() {
    5040        String css = "relation >[\"my_role\"] way{}";
    5141        MapCSSStyleSource source = new MapCSSStyleSource(css);
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java

    r17275 r18870  
    66import javax.swing.JOptionPane;
    77
    8 import org.junit.jupiter.api.extension.RegisterExtension;
    98import org.junit.jupiter.api.Test;
    109import org.openstreetmap.josm.TestUtils;
    1110import org.openstreetmap.josm.data.Preferences;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
     11import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
     12import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1313import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    14 
    15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1614
    1715/**
    1816 * Unit tests of {@link ExportProfileAction} class.
    1917 */
     18@AssertionsInEDT
     19@BasicPreferences
    2020class ExportProfileActionTest {
    21     /**
    22      * Setup tests
    23      */
    24     @RegisterExtension
    25     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
    27 
    2821    /**
    2922     * Unit test of {@link ExportProfileAction#actionPerformed}.
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java

    r17275 r18870  
    77import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    9 import java.util.Arrays;
     9import java.util.Collections;
    1010
    1111import javax.swing.JOptionPane;
    1212
    13 import org.junit.jupiter.api.extension.RegisterExtension;
    1413import org.junit.jupiter.api.Test;
    1514import org.openstreetmap.josm.TestUtils;
     
    1716import org.openstreetmap.josm.gui.preferences.advanced.PreferencesTable.AllSettingsTableModel;
    1817import org.openstreetmap.josm.spi.preferences.StringSetting;
    19 import org.openstreetmap.josm.testutils.JOSMTestRules;
     18import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
     19import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2020import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
    2121import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    22 
    23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2422
    2523/**
    2624 * Unit tests of {@link PreferencesTable} class.
    2725 */
     26@AssertionsInEDT
     27@BasicPreferences
    2828class PreferencesTableTest {
    29     /**
    30      * Setup tests
    31      */
    32     @RegisterExtension
    33     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    34     public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
    35 
    3629    private static PrefEntry newPrefEntry(String value) {
    3730        StringSetting val = new StringSetting(value);
     
    4134
    4235    private static PreferencesTable newTable() {
    43         return new PreferencesTable(Arrays.asList(newPrefEntry("value")));
     36        return new PreferencesTable(Collections.singletonList(newPrefEntry("value")));
    4437    }
    4538
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java

    r17275 r18870  
    55
    66import java.io.File;
    7 import java.util.Arrays;
     7import java.util.Collections;
    88
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.junit.jupiter.api.Test;
    1110import org.openstreetmap.josm.TestUtils;
    1211import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
    1312import org.openstreetmap.josm.spi.preferences.Config;
    14 import org.openstreetmap.josm.testutils.JOSMTestRules;
    15 
    16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     13import org.openstreetmap.josm.testutils.annotations.Main;
    1714
    1815/**
    1916 * Unit tests of {@link ImageryPreference} class.
    2017 */
     18@Main
    2119class ImageryPreferenceTest {
    22 
    23     /**
    24      * Setup tests
    25      */
    26     @RegisterExtension
    27     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().main();
    29 
    3020    /**
    3121     * Unit test of {@link ImageryPreference#ImageryPreference}.
     
    4232    void testAddGui() {
    4333        String fileUrl = new File(TestUtils.getTestDataRoot()+"__files/imagery/maps.xml").toURI().toString();
    44         Config.getPref().putList("imagery.layers.sites", Arrays.asList(fileUrl));
     34        Config.getPref().putList("imagery.layers.sites", Collections.singletonList(fileUrl));
    4535        PreferencesTestUtils.doTestPreferenceSettingAddGui(new ImageryPreference.Factory(), null);
    4636    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java

    r18690 r18870  
    2929import org.junit.jupiter.api.AfterAll;
    3030import org.junit.jupiter.api.BeforeAll;
     31import org.junit.jupiter.api.Disabled;
    3132import org.junit.jupiter.api.extension.RegisterExtension;
    3233import org.junit.jupiter.api.parallel.Execution;
     
    435436    @ParameterizedTest(name = "{0}")
    436437    @MethodSource("data")
     438    @Disabled("Takes a long time")
    437439    void testImageryEntryValidity(String id, ImageryInfo info) {
    438440        checkEntry(info);
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java

    r17275 r18870  
    66
    77import java.io.File;
    8 import java.util.Arrays;
    98import java.util.Collection;
    109import java.util.Collections;
    1110
    1211import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.extension.RegisterExtension;
    1412import org.openstreetmap.josm.TestUtils;
    1513import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1816import org.openstreetmap.josm.plugins.PluginException;
    1917import org.openstreetmap.josm.plugins.PluginInformation;
    20 import org.openstreetmap.josm.testutils.JOSMTestRules;
     18import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
     19import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2120import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker;
    22 
    23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2421
    2522/**
    2623 * Unit tests of {@link PluginPreference} class.
    2724 */
     25@AssertionsInEDT
     26@BasicPreferences
    2827public class PluginPreferenceTest {
    29     /**
    30      * Setup test.
    31      */
    32     @RegisterExtension
    33     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    34     public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
    35 
    3628    /**
    3729     * Unit test of {@link PluginPreference#PluginPreference}.
     
    6052        final PluginInformation dummy = getDummyPluginInformation();
    6153        assertEquals("", PluginPreference.buildDownloadSummary(
    62                 new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.<PluginInformation>emptyList(), "")));
     54                new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.emptyList(), "")));
    6355        assertEquals("", PluginPreference.buildDownloadSummary(
    64                 new PluginDownloadTask(NullProgressMonitor.INSTANCE, Arrays.asList(dummy), "")));
     56                new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.singletonList(dummy), "")));
    6557        assertEquals("The following plugin has been downloaded <strong>successfully</strong>:<ul><li>dummy_plugin (31772)</li></ul>"+
    6658                     "Downloading the following plugin has <strong>failed</strong>:<ul><li>dummy_plugin</li></ul>"+
    6759                     "<br>Error message(untranslated): test",
    6860                PluginPreference.buildDownloadSummary(
    69                         new PluginDownloadTask(NullProgressMonitor.INSTANCE, Arrays.asList(dummy), "") {
     61                        new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.singletonList(dummy), "") {
    7062                    @Override
    7163                    public Collection<PluginInformation> getFailedPlugins() {
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java

    r18853 r18870  
    7878     */
    7979    @Test
    80     void testReadDefaulPresets() throws SAXException, IOException {
     80    void testReadDefaultPresets() throws SAXException, IOException {
    8181        String presetfile = "resource://data/defaultpresets.xml";
    8282        final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, true);
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetValidationTest.java

    r18051 r18870  
    55import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import java.util.Arrays;
    8 import java.util.Locale;
     7import java.util.Collections;
    98
    109import javax.swing.JLabel;
     
    1211import org.junit.jupiter.api.BeforeEach;
    1312import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1513import org.openstreetmap.josm.data.osm.DataSet;
    1614import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1816import org.openstreetmap.josm.data.osm.Tag;
    1917import org.openstreetmap.josm.data.validation.OsmValidator;
    20 import org.openstreetmap.josm.testutils.JOSMTestRules;
    21 
    22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     18import org.openstreetmap.josm.testutils.annotations.I18n;
     19import org.openstreetmap.josm.testutils.annotations.Projection;
    2320
    2421/**
    2522 * Unit tests for {@code TaggingPresetValidation}
    2623 */
     24@Projection
     25@I18n
    2726class TaggingPresetValidationTest {
    28 
    29     /**
    30      * Setup test.
    31      */
    32     @RegisterExtension
    33     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    34     public JOSMTestRules rule = new JOSMTestRules().projection();
    35 
    3627    @BeforeEach
    3728    void setUp() {
    38         Locale.setDefault(Locale.ENGLISH);
    3929        OsmValidator.initialize();
    4030    }
     
    6959        OsmPrimitive primitive = OsmUtils.createPrimitive("way incline=10m width=1mm opening_hours=\"Mo-Fr 8-10\"");
    7060        new DataSet(primitive);
    71         OsmPrimitive clone = TaggingPresetValidation.applyChangedTags(primitive, Arrays.asList(new Tag("incline", "20m")));
     61        OsmPrimitive clone = TaggingPresetValidation.applyChangedTags(primitive, Collections.singletonList(new Tag("incline", "20m")));
    7262        assertEquals("20m", clone.get("incline"));
    7363        assertEquals("1mm", clone.get("width"));
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java

    r18690 r18870  
    1515import javax.swing.JSeparator;
    1616
    17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    18 import net.trajano.commons.testing.UtilityClassTestUtil;
    1917import org.junit.jupiter.api.Test;
    20 import org.junit.jupiter.api.extension.RegisterExtension;
    2118import org.junit.jupiter.params.ParameterizedTest;
    2219import org.junit.jupiter.params.provider.ValueSource;
     
    2421import org.openstreetmap.josm.gui.MainApplication;
    2522import org.openstreetmap.josm.gui.MainMenu;
    26 import org.openstreetmap.josm.testutils.JOSMTestRules;
     23import org.openstreetmap.josm.testutils.annotations.Main;
    2724import org.openstreetmap.josm.tools.Logging;
     25
     26import net.trajano.commons.testing.UtilityClassTestUtil;
    2827
    2928/**
    3029 * Unit tests of {@link TaggingPresets} class.
    3130 */
     31@Main
    3232public class TaggingPresetsTest {
    33 
    34     /**
    35      * Setup rule
    36      */
    37     @RegisterExtension
    38     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    39     public JOSMTestRules test = new JOSMTestRules().main();
    40 
    4133    /**
    4234     * Tests that {@code TaggingPresets} satisfies utility class criteria.
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java

    r17609 r18870  
    77import javax.swing.JPanel;
    88
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.junit.jupiter.api.Test;
    1110import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
    13 
    14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     11import org.openstreetmap.josm.testutils.annotations.Main;
    1512
    1613/**
    1714 * Unit tests of {@link Check} class.
    1815 */
     16@Main
    1917class CheckTest {
    20 
    21     /**
    22      * Setup test.
    23      */
    24     @RegisterExtension
    25     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules test = new JOSMTestRules().main();
    27 
    2818    /**
    2919     * Unit test for {@link Check#addToPanel}.
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java

    r18260 r18870  
    1010
    1111import org.junit.jupiter.api.Test;
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1312import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1413import org.openstreetmap.josm.data.osm.OsmUtils;
    1514import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     15import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     16import org.openstreetmap.josm.testutils.annotations.I18n;
     17import org.openstreetmap.josm.testutils.annotations.Main;
    1918
    2019/**
    2120 * Unit tests of {@link Combo} class.
    2221 */
     22@BasicPreferences
     23@I18n("de")
     24@Main
    2325class ComboTest {
    24 
    25     /**
    26      * Setup test.
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().preferences().main().i18n("de");
    31 
    3226    /**
    3327     * Unit test for {@link Combo#addToPanel}.
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java

    r18853 r18870  
    99import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
     11import org.openstreetmap.josm.testutils.annotations.Main;
    1112
    1213/**
    1314 * Unit tests of {@link MultiSelect} class.
    1415 */
     16@Main
    1517class MultiSelectTest {
    1618    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java

    r17609 r18870  
    88import javax.swing.JPanel;
    99
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.junit.jupiter.api.Test;
    1211import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    13 import org.openstreetmap.josm.testutils.JOSMTestRules;
    14 
    15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     12import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
    1613
    1714/**
    1815 * Unit tests of {@link PresetLink} class.
    1916 */
     17@TaggingPresets
    2018class PresetLinkTest {
    21 
    22     /**
    23      * Setup test.
    24      */
    25     @RegisterExtension
    26     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    27     public JOSMTestRules rule = new JOSMTestRules().presets();
    28 
    2919    /**
    3020     * Unit test for {@link PresetLink#addToPanel}.
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java

    r17609 r18870  
    77import javax.swing.JPanel;
    88
    9 import org.junit.jupiter.api.extension.RegisterExtension;
    109import org.junit.jupiter.api.Test;
    1110import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport;
    12 import org.openstreetmap.josm.testutils.JOSMTestRules;
    13 
    14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     11import org.openstreetmap.josm.testutils.annotations.Main;
    1512
    1613/**
    1714 * Unit tests of {@link Text} class.
    1815 */
     16@Main
    1917class TextTest {
    20 
    21     /**
    22      * Setup test.
    23      */
    24     @RegisterExtension
    25     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules test = new JOSMTestRules().main();
    27 
    2818    /**
    2919     * Unit test for {@link Text#addToPanel}.
  • trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java

    r17275 r18870  
    1010import java.util.Arrays;
    1111
    12 import org.junit.jupiter.api.BeforeAll;
    1312import org.junit.jupiter.api.Test;
    14 import org.openstreetmap.josm.JOSMFixture;
    1513import org.openstreetmap.josm.TestUtils;
    1614import org.openstreetmap.josm.data.coor.LatLon;
     
    1816import org.openstreetmap.josm.data.osm.Node;
    1917import org.openstreetmap.josm.data.osm.Way;
     18import org.openstreetmap.josm.testutils.annotations.Projection;
    2019
    2120/**
    2221 * Unit tests of {@link GeoJSONWriter} class.
    2322 */
     23@Projection
    2424class GeoJSONWriterTest {
    25 
    26     /**
    27      * Setup test.
    28      */
    29     @BeforeAll
    30     public static void setUp() {
    31         JOSMFixture.createUnitTestFixture().init();
    32     }
    33 
    3425    /**
    3526     * Unit test for Point
  • trunk/test/unit/org/openstreetmap/josm/io/ValidatorErrorWriterTest.java

    r18000 r18870  
    77import java.io.IOException;
    88import java.nio.charset.StandardCharsets;
    9 import java.util.Arrays;
    109import java.util.Collection;
    1110import java.util.Collections;
     
    1312
    1413import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    1614import org.openstreetmap.josm.data.coor.LatLon;
    1715import org.openstreetmap.josm.data.osm.Node;
     
    1917import org.openstreetmap.josm.data.validation.TestError;
    2018import org.openstreetmap.josm.data.validation.tests.RightAngleBuildingTest;
    21 import org.openstreetmap.josm.testutils.JOSMTestRules;
    22 
    23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     19import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2420
    2521/**
    2622 * Unit tests of {@link ValidatorErrorWriter}
    2723 */
     24@BasicPreferences
    2825class ValidatorErrorWriterTest {
    29 
    30     /**
    31      * Setup rule
    32      */
    33     @RegisterExtension
    34     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().preferences();
    36 
    3726    @Test
    3827    void testEmpty() throws IOException {
     
    4332    void testErrors() throws IOException {
    4433        Locale.setDefault(Locale.ENGLISH);
    45         doTest(Arrays.asList(TestError.builder(new RightAngleBuildingTest(), Severity.OTHER, 3701)
    46                 .message("Building with an almost square angle")
    47                 .primitives(new Node(LatLon.NORTH_POLE)).build()),
     34        doTest(Collections.singletonList(TestError.builder(new RightAngleBuildingTest(), Severity.OTHER, 3701)
     35                        .message("Building with an almost square angle")
     36                        .primitives(new Node(LatLon.NORTH_POLE)).build()),
    4837                  "  <analyser timestamp='\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3,9}Z' name='Almost right angle buildings'>"
    4938                + "    <class id='1' level='3'>"
  • trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java

    r18106 r18870  
    1212
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.TestUtils;
    1615import org.openstreetmap.josm.io.imagery.WMSImagery.WMSGetCapabilitiesException;
    17 import org.openstreetmap.josm.testutils.JOSMTestRules;
     16import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1817import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
     18import org.openstreetmap.josm.testutils.annotations.Projection;
    1919
    2020import com.github.tomakehurst.wiremock.WireMockServer;
    2121import com.github.tomakehurst.wiremock.client.WireMock;
    2222
    23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    24 
    2523/**
    2624 * Unit tests of {@link WMSImagery} class.
    2725 */
     26@BasicPreferences(true)
    2827@BasicWiremock
     28@Projection
    2929class WMSImageryTest {
    30 
    31     /**
    32      * Setup test
    33      */
    34     @RegisterExtension
    35     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    36     JOSMTestRules test = new JOSMTestRules().projection();
    37 
    3830    @BasicWiremock
    3931    WireMockServer tileServer;
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java

    r17275 r18870  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    77
    8 import org.junit.jupiter.api.extension.RegisterExtension;
    98import org.junit.jupiter.api.Test;
    109import org.openstreetmap.josm.data.osm.DataSet;
     
    1211import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1312import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
    14 import org.openstreetmap.josm.testutils.JOSMTestRules;
    15 
    16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     13import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
     14import org.openstreetmap.josm.testutils.annotations.Main;
     15import org.openstreetmap.josm.testutils.annotations.Projection;
    1716
    1817/**
    1918 * Unit tests of {@link AddNodeHandler} class.
    2019 */
     20@AssertionsInEDT
     21@Main
     22@Projection
    2123class AddNodeHandlerTest {
    22     /**
    23      * Setup test.
    24      */
    25     @RegisterExtension
    26     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    27     public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection();
    28 
    2924    private static AddNodeHandler newHandler(String url) throws RequestHandlerBadRequestException {
    3025        AddNodeHandler req = new AddNodeHandler();
     
    3833     */
    3934    @Test
    40     void testBadRequestNoLayer() {
    41         Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?lat=0&lon=0").handle());
     35    void testBadRequestNoLayer() throws RequestHandlerBadRequestException {
     36        final AddNodeHandler handler = newHandler("https://localhost?lat=0&lon=0");
     37        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
    4238        assertEquals("There is no layer opened to add node", e.getMessage());
    4339    }
     
    4743     */
    4844    @Test
    49     void testBadRequestNoParam() {
     45    void testBadRequestNoParam() throws RequestHandlerBadRequestException {
    5046        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    5147        MainApplication.getLayerManager().addLayer(layer);
    52         Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
     48        final AddNodeHandler handler = newHandler(null);
     49        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
    5350        assertEquals("NumberFormatException (empty String)", e.getMessage());
    5451    }
     
    5855     */
    5956    @Test
    60     void testBadRequestInvalidUrl() {
    61         Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
     57    void testBadRequestInvalidUrl() throws RequestHandlerBadRequestException {
     58        final AddNodeHandler handler = newHandler("invalid_url");
     59        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
    6260        assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage());
    6361    }
     
    6765     */
    6866    @Test
    69     void testBadRequestIncompleteUrl() {
    70         Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
     67    void testBadRequestIncompleteUrl() throws RequestHandlerBadRequestException {
     68        final AddNodeHandler handler = newHandler("https://localhost");
     69        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
    7170        assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage());
    7271    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java

    r17275 r18870  
    22package org.openstreetmap.josm.io.remotecontrol.handler;
    33
     4import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    45import static org.junit.jupiter.api.Assertions.assertEquals;
    5 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    77
    88import java.io.File;
    99
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    1110import org.junit.jupiter.api.Test;
    1211import org.openstreetmap.josm.TestUtils;
     
    1413import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1514import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
     15import org.openstreetmap.josm.testutils.annotations.Main;
    1716import org.openstreetmap.josm.tools.Utils;
    18 
    19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2017
    2118/**
    2219 * Unit tests of {@link ImportHandler} class.
    2320 */
     21@Main
    2422class ImportHandlerTest {
    25     /**
    26      * Setup test.
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().main();
    31 
    3223    private static ImportHandler newHandler(String url) throws RequestHandlerBadRequestException {
    3324        ImportHandler req = new ImportHandler();
     
    5344    @Test
    5445    void testBadRequestNoParam() throws Exception {
    55         Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
    56         assertEquals("MalformedURLException: null", e.getMessage());
     46        final ImportHandler handler = newHandler(null);
     47        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
     48        // This has differing behavior after Java 15
     49        if ("MalformedURLException: null".length() == e.getMessage().length()) {
     50            assertEquals("MalformedURLException: null", e.getMessage());
     51        } else {
     52            assertEquals("MalformedURLException: Cannot invoke \"String.length()\" because \"spec\" is null", e.getMessage());
     53        }
    5754    }
    5855
     
    6360    @Test
    6461    void testBadRequestInvalidUrl() throws Exception {
    65         Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?url=invalid_url").handle());
     62        final ImportHandler handler = newHandler("https://localhost?url=invalid_url");
     63        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
    6664        assertEquals("MalformedURLException: no protocol: invalid_url", e.getMessage());
    6765    }
     
    7371    @Test
    7472    void testBadRequestIncompleteUrl() throws Exception {
    75         Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
     73        final ImportHandler handler = newHandler("https://localhost?lat=0&lon=0");
     74        Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle);
    7675        assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage());
    7776    }
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r18690 r18870  
    2424import org.junit.jupiter.api.BeforeEach;
    2525import org.junit.jupiter.api.Test;
    26 import org.junit.jupiter.api.extension.RegisterExtension;
    2726import org.openstreetmap.josm.TestUtils;
    2827import org.openstreetmap.josm.data.coor.LatLon;
     
    4241import org.openstreetmap.josm.gui.layer.TMSLayer;
    4342import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    44 import org.openstreetmap.josm.testutils.JOSMTestRules;
     43import org.openstreetmap.josm.testutils.annotations.Main;
     44import org.openstreetmap.josm.testutils.annotations.Projection;
    4545import org.openstreetmap.josm.tools.MultiMap;
    4646import org.openstreetmap.josm.tools.Utils;
    47 
    48 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    4947
    5048/**
    5149 * Unit tests for Session writing.
    5250 */
     51@Main
     52@Projection
    5353public class SessionWriterTest {
    5454
     
    9696        }
    9797    }
    98 
    99     /**
    100      * Setup tests.
    101      */
    102     @RegisterExtension
    103     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    104     public JOSMTestRules test = new JOSMTestRules().projection().main();
    10598
    10699    /**
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java

    r18694 r18870  
    1818import java.util.stream.Collectors;
    1919
    20 import com.github.tomakehurst.wiremock.client.WireMock;
    21 import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
    22 import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
    23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2420import org.junit.jupiter.api.BeforeEach;
    2521import org.junit.jupiter.api.Test;
     
    2925import org.openstreetmap.josm.gui.MainApplication;
    3026import org.openstreetmap.josm.spi.preferences.Config;
    31 import org.openstreetmap.josm.testutils.JOSMTestRules;
    3227import org.openstreetmap.josm.testutils.PluginServer;
    3328import org.openstreetmap.josm.testutils.annotations.AssumeRevision;
    3429import org.openstreetmap.josm.testutils.annotations.FullPreferences;
     30import org.openstreetmap.josm.testutils.annotations.Main;
    3531import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
    3632import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker;
     33
     34import com.github.tomakehurst.wiremock.client.WireMock;
     35import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
     36import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
    3737
    3838/**
     
    4141@AssumeRevision("Revision: 6000\n")
    4242@FullPreferences
     43@Main
    4344class PluginHandlerJOSMTooOldTest {
    44     /**
    45      * Setup test.
    46      */
    47     @RegisterExtension
    48     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    49     static JOSMTestRules test = new JOSMTestRules().main();
    50 
    5145    /**
    5246     * Plugin server mock.
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java

    r18694 r18870  
    1717import java.util.stream.Collectors;
    1818
    19 import com.github.tomakehurst.wiremock.client.WireMock;
    20 import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
    21 import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
    22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2319import org.junit.jupiter.api.BeforeEach;
    2420import org.junit.jupiter.api.Test;
     
    2824import org.openstreetmap.josm.gui.MainApplication;
    2925import org.openstreetmap.josm.spi.preferences.Config;
    30 import org.openstreetmap.josm.testutils.JOSMTestRules;
    3126import org.openstreetmap.josm.testutils.PluginServer;
    3227import org.openstreetmap.josm.testutils.annotations.AssumeRevision;
    3328import org.openstreetmap.josm.testutils.annotations.FullPreferences;
     29import org.openstreetmap.josm.testutils.annotations.Main;
    3430import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
     31
     32import com.github.tomakehurst.wiremock.client.WireMock;
     33import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
     34import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
    3535
    3636/**
     
    3838 */
    3939@FullPreferences
     40@Main
    4041class PluginHandlerMultiVersionTest {
    41     /**
    42      * Setup test.
    43      */
    44     @RegisterExtension
    45     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    46     static JOSMTestRules test = new JOSMTestRules().main();
    47 
    4842    /**
    4943     * Plugin server mock.
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r18690 r18870  
    2424import java.util.Map;
    2525import java.util.TimeZone;
     26import java.util.concurrent.TimeUnit;
    2627import java.util.logging.Handler;
    2728import java.util.logging.Level;
    2829
    29 import mockit.internal.state.SavePoint;
    3030import org.awaitility.Awaitility;
     31import org.awaitility.Durations;
    3132import org.junit.jupiter.api.extension.AfterAllCallback;
    3233import org.junit.jupiter.api.extension.AfterEachCallback;
     
    5455import org.openstreetmap.josm.data.projection.Projections;
    5556import org.openstreetmap.josm.gui.MainApplication;
    56 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    5757import org.openstreetmap.josm.gui.oauth.OAuthAuthorizationWizard;
    5858import org.openstreetmap.josm.gui.preferences.imagery.ImageryPreferenceTestIT;
    59 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
    6059import org.openstreetmap.josm.gui.util.GuiHelper;
    6160import org.openstreetmap.josm.io.CertificateAmendment;
     
    6665import org.openstreetmap.josm.spi.preferences.Config;
    6766import org.openstreetmap.josm.spi.preferences.Setting;
     67import org.openstreetmap.josm.testutils.annotations.JosmDefaults;
     68import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
     69import org.openstreetmap.josm.testutils.annotations.TaggingPresets;
     70import org.openstreetmap.josm.testutils.annotations.Territories;
    6871import org.openstreetmap.josm.testutils.mockers.EDTAssertionMocker;
    6972import org.openstreetmap.josm.testutils.mockers.WindowlessMapViewStateMocker;
     
    7679import org.openstreetmap.josm.tools.MemoryManagerTest;
    7780import org.openstreetmap.josm.tools.PlatformManager;
    78 import org.openstreetmap.josm.tools.Territories;
    7981import org.openstreetmap.josm.tools.Utils;
    8082import org.openstreetmap.josm.tools.bugreport.ReportedException;
     
    8284
    8385import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     86import mockit.internal.state.SavePoint;
    8487
    8588/**
     
    591594        if (useMapStyles) {
    592595            // Reset the map paint styles.
    593             MapPaintStyles.readFromPreferences();
     596            MapPaintStyles.MapPaintStylesExtension.setup();
    594597        }
    595598
    596599        if (usePresets) {
    597600            // Reset the presets.
    598             TaggingPresets.readFromPreferences();
     601            TaggingPresets.TaggingPresetsExtension.setup();
    599602        }
    600603
    601604        if (territories) {
    602             Territories.initializeInternalData();
     605            Territories.TerritoriesExtension.setup(Territories.Initialize.INTERNAL);
    603606        }
    604607
     
    632635
    633636    private void workaroundJdkBug8159956() {
     637        // Note: This has been backported to Java 8u381 (2023-07-18)
    634638        try {
    635639            if (PlatformManager.isPlatformWindows() && Utils.getJavaVersion() == 8 && GraphicsEnvironment.isHeadless()) {
     
    652656        cleanLayerEnvironment();
    653657        Preferences.main().resetToInitialState();
    654         System.gc();
     658        JosmDefaults.DefaultsExtension.memoryCleanup();
    655659    }
    656660
     
    689693        final boolean[] queueEmpty = {false};
    690694        MainApplication.worker.submit(() -> queueEmpty[0] = true);
    691         Awaitility.await().forever().until(() -> queueEmpty[0]);
     695        // Default pollInterval is 100ms, which means that each test takes (at minimum) .1s.
     696        Awaitility.await().pollDelay(0, TimeUnit.SECONDS).pollInterval(Durations.ONE_MILLISECOND).forever().until(() -> queueEmpty[0]);
    692697        // Remove all layers
    693698        cleanLayerEnvironment();
     
    718723
    719724        // Parts of JOSM uses weak references - destroy them.
    720         System.gc();
     725        JosmDefaults.DefaultsExtension.memoryCleanup();
    721726    }
    722727
  • trunk/test/unit/org/openstreetmap/josm/testutils/annotations/BasicPreferences.java

    r18694 r18870  
    2828/**
    2929 * Allow tests to use JOSM preferences (see {@link JOSMTestRules#preferences()}).
    30  * This is often enough for basic tests.
     30 * This is often enough for basic tests. There are two modes:
     31 * <ul>
     32 *     <li>Between test classes (usually enough) if annotated at the class level ({@link ElementType#TYPE})</li>
     33 *     <li>Between test methods if annotated at the method level ({@link ElementType#METHOD})</li>
     34 *     <li>Between test method if annotated at the class level <i>and</i> the annotated value is {@code true}</li>
     35 * </ul>
    3136 *
    3237 * @author Taylor Smock
     
    4045@ExtendWith(BasicPreferences.BasicPreferencesExtension.class)
    4146public @interface BasicPreferences {
     47    /**
     48     * Clear preferences between tests
     49     * @return {@code true} if the preferences should be cleared between tests
     50     */
     51    boolean value() default false;
    4252
    4353    /**
     
    8090        @Override
    8191        public void beforeEach(ExtensionContext context) throws Exception {
    82             if (AnnotationSupport.isAnnotated(context.getElement(), BasicPreferences.class) || Config.getPref() == null) {
     92            if (AnnotationSupport.isAnnotated(context.getElement(), BasicPreferences.class) || Config.getPref() == null
     93            || AnnotationUtils.findFirstParentAnnotation(context, BasicPreferences.class).map(BasicPreferences::value).orElse(false)) {
    8394                this.beforeAll(context);
    8495            }
  • trunk/test/unit/org/openstreetmap/josm/testutils/annotations/I18n.java

    r18694 r18870  
    44import java.lang.annotation.Documented;
    55import java.lang.annotation.ElementType;
     6import java.lang.annotation.Inherited;
    67import java.lang.annotation.Retention;
    78import java.lang.annotation.RetentionPolicy;
     
    1314import org.junit.jupiter.api.extension.ExtendWith;
    1415import org.junit.jupiter.api.extension.ExtensionContext;
    15 import org.junit.platform.commons.support.AnnotationSupport;
    1616import org.openstreetmap.josm.tools.LanguageInfo;
    1717
     
    2323 */
    2424@Documented
     25@Inherited
    2526@Retention(RetentionPolicy.RUNTIME)
    2627@Target({ElementType.TYPE, ElementType.METHOD})
     
    4243        @Override
    4344        public void beforeEach(ExtensionContext context) {
    44             String language = AnnotationSupport.findAnnotation(context.getElement(), I18n.class).map(I18n::value).orElse("en");
     45            String language = AnnotationUtils.findFirstParentAnnotation(context, I18n.class).map(I18n::value).orElse("en");
    4546            if (!Locale.getDefault().equals(LanguageInfo.getLocale(language, false))) {
    4647                org.openstreetmap.josm.tools.I18n.set(language);
  • trunk/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java

    r18853 r18870  
    1010import java.util.Arrays;
    1111
     12import org.junit.jupiter.api.extension.AfterAllCallback;
    1213import org.junit.jupiter.api.extension.AfterEachCallback;
     14import org.junit.jupiter.api.extension.BeforeAllCallback;
    1315import org.junit.jupiter.api.extension.BeforeEachCallback;
    1416import org.junit.jupiter.api.extension.ExtendWith;
     
    2527import org.openstreetmap.josm.tools.Logging;
    2628import org.openstreetmap.josm.tools.MemoryManagerTest;
     29import org.openstreetmap.josm.tools.Utils;
    2730
    2831/**
     
    3841     * Functionality that this provides may be moved to other classes.
    3942     */
    40     class DefaultsExtension implements BeforeEachCallback, AfterEachCallback {
     43    class DefaultsExtension implements BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback {
     44        private static final boolean PERFORM_MEMORY_CLEANUP =
     45                !Boolean.parseBoolean(System.getProperty("test.without.gc", Boolean.FALSE.toString()));
     46        private static final int JAVA_VERSION = Utils.getJavaVersion();
     47
     48        @Override
     49        public void beforeAll(ExtensionContext extensionContext) throws Exception {
     50            cleanUpFromJosmFixture();
     51        }
     52
    4153        @Override
    4254        public void beforeEach(ExtensionContext context) throws Exception {
    43             cleanUpFromJosmFixture();
    4455            // Assume anonymous user
    4556            if (!UserIdentityManager.getInstance().isAnonymous()) {
     
    7081                }
    7182            });
     83        }
    7284
     85        @Override
     86        public void afterAll(ExtensionContext extensionContext) throws Exception {
    7387            // Parts of JOSM uses weak references - destroy them.
    74             System.gc();
     88            memoryCleanup();
    7589        }
    7690
     
    8498            Preferences.main().resetToInitialState();
    8599            Preferences.main().enableSaveOnPut(false);
    86             System.gc();
     100            memoryCleanup();
     101        }
     102
     103        /**
     104         * Call {@link System#gc()}
     105         * Warning: This is a very expensive method! GC is expensive!
     106         * For reference, a test run without gc will take ~7 minutes.
     107         * 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).
     108         * <p>
     109         * If you want to do a test run without manual calls to gc, add `-Dtest.without.gc=true` to the arguments.
     110         */
     111        public static void memoryCleanup() {
     112            if (PERFORM_MEMORY_CLEANUP) {
     113                System.gc();
     114                // Finalization was deprecated in Java 18
     115                if (JAVA_VERSION <= 17) {
     116                    System.runFinalization();
     117                }
     118            }
    87119        }
    88120    }
  • trunk/test/unit/org/openstreetmap/josm/testutils/annotations/Territories.java

    r18798 r18870  
    44import java.lang.annotation.Documented;
    55import java.lang.annotation.ElementType;
     6import java.lang.annotation.Inherited;
    67import java.lang.annotation.Retention;
    78import java.lang.annotation.RetentionPolicy;
     
    2829@BasicPreferences // Needed for nodes
    2930@Projection // Needed for getEastNorth
     31@Inherited
    3032@ExtendWith(Territories.TerritoriesExtension.class)
    3133public @interface Territories {
     
    6365
    6466        @Override
    65         public void beforeAll(ExtensionContext context) throws Exception {
     67        public void beforeAll(ExtensionContext context) {
    6668            this.beforeEach(context);
    6769        }
    6870
    6971        @Override
    70         public void beforeEach(ExtensionContext context) throws Exception {
     72        public void beforeEach(ExtensionContext context) {
    7173            Optional<Territories> annotation = AnnotationSupport.findAnnotation(context.getElement(),
    7274                    Territories.class);
    7375            if (annotation.isPresent()) {
    7476                Initialize current = annotation.get().value();
    75                 if (current.ordinal() <= last.ordinal()) {
    76                     return;
    77                 }
    78                 last = current;
    79                 // Avoid potential race conditions if tests are parallelized
    80                 synchronized (TerritoriesExtension.class) {
    81                     if (current == Initialize.INTERNAL) {
    82                         org.openstreetmap.josm.tools.Territories.initializeInternalData();
    83                     } else if (current == Initialize.ALL) {
    84                         org.openstreetmap.josm.tools.Territories.initialize();
    85                     }
     77                setup(current);
     78            }
     79        }
     80
     81        /**
     82         * Set up the test
     83         * @param current The current level to initialize {@link org.openstreetmap.josm.tools.Territories} to
     84         */
     85        public static void setup(Initialize current) {
     86            if (current.ordinal() <= last.ordinal()) {
     87                return;
     88            }
     89            last = current;
     90            // Avoid potential race conditions if tests are parallelized
     91            synchronized (TerritoriesExtension.class) {
     92                if (current == Initialize.INTERNAL) {
     93                    org.openstreetmap.josm.tools.Territories.initializeInternalData();
     94                } else if (current == Initialize.ALL) {
     95                    org.openstreetmap.josm.tools.Territories.initialize();
    8696                }
    8797            }
  • trunk/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java

    r17840 r18870  
    1313import org.junit.jupiter.api.BeforeEach;
    1414import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    1615import org.openstreetmap.josm.io.ChangesetClosedException;
    1716import org.openstreetmap.josm.io.IllegalDataException;
     
    2221import org.openstreetmap.josm.io.OsmApiInitializationException;
    2322import org.openstreetmap.josm.io.auth.CredentialsManager;
    24 import org.openstreetmap.josm.testutils.JOSMTestRules;
     23import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2524import org.openstreetmap.josm.tools.date.DateUtils;
    2625import org.openstreetmap.josm.tools.date.DateUtilsTest;
    27 
    28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2926
    3027/**
    3128 * Unit tests of {@link ExceptionUtil} class.
    3229 */
     30@BasicPreferences
     31@org.openstreetmap.josm.testutils.annotations.OsmApi(org.openstreetmap.josm.testutils.annotations.OsmApi.APIType.FAKE)
    3332class ExceptionUtilTest {
    34 
    35     /**
    36      * Setup rule.
    37      */
    38     @RegisterExtension
    39     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    40     public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
    41 
    4233    private static String baseUrl;
    4334    private static String serverUrl;
  • trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java

    r18690 r18870  
    1010import java.util.stream.Stream;
    1111
    12 import org.junit.jupiter.api.extension.RegisterExtension;
    1312import org.junit.jupiter.api.Test;
    14 import org.openstreetmap.josm.testutils.JOSMTestRules;
    15 
    16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     13import org.openstreetmap.josm.testutils.annotations.I18n;
    1714
    1815/**
    1916 * Unit tests of {@link LanguageInfo}.
    2017 */
     18@I18n("ca@valencia")
    2119class LanguageInfoTest {
    22 
    23     /**
    24      * Setup test.
    25      */
    26     @RegisterExtension
    27     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().i18n("ca@valencia");
    29 
    3020    private static final Locale EN_NZ = new Locale("en", "NZ");
    3121    private static final Locale DE_DE = Locale.GERMANY;
  • trunk/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java

    r17275 r18870  
    1111import javax.swing.ImageIcon;
    1212
    13 import org.junit.jupiter.api.BeforeAll;
    1413import org.junit.jupiter.api.Test;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    16 import org.openstreetmap.josm.JOSMFixture;
    1714import org.openstreetmap.josm.data.osm.Node;
    1815import org.openstreetmap.josm.data.osm.OsmUtils;
    1916import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
    2017import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetsTest;
    21 import org.openstreetmap.josm.testutils.JOSMTestRules;
     18import org.openstreetmap.josm.testutils.annotations.MapPaintStyles;
    2219import org.openstreetmap.josm.tools.OsmPrimitiveImageProvider.Options;
    23 
    24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2520
    2621/**
    2722 * Unit tests of {@link OsmPrimitiveImageProvider}
    2823 */
     24@MapPaintStyles
     25@org.openstreetmap.josm.testutils.annotations.TaggingPresets
    2926class OsmPrimitiveImageProviderTest {
    30 
    31     /**
    32      * Setup test.
    33      */
    34     @RegisterExtension
    35     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    36     public JOSMTestRules test = new JOSMTestRules().mapStyles().presets();
    37 
    38     /**
    39      * Setup test.
    40      */
    41     @BeforeAll
    42     public static void setUp() {
    43         JOSMFixture.createUnitTestFixture().init();
    44     }
    45 
    4627    /**
    4728     * Unit test of {@link OsmPrimitiveImageProvider#getResource}.
  • trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java

    r17275 r18870  
    88
    99import org.junit.jupiter.api.Test;
    10 import org.junit.jupiter.api.extension.RegisterExtension;
    11 import org.openstreetmap.josm.testutils.JOSMTestRules;
    12 
    13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     10import org.openstreetmap.josm.testutils.annotations.Projection;
    1411
    1512/**
    1613 * Integration tests of {@link Territories} class.
    1714 */
     15@Projection
    1816class TerritoriesTestIT {
    19 
    20     /**
    21      * Test rules.
    22      */
    23     @RegisterExtension
    24     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    25     public JOSMTestRules rules = new JOSMTestRules().projection();
    26 
    27 
    2817    /**
    2918     * Test of {@link Territories#initialize} method.
  • trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java

    r18735 r18870  
    1717import java.util.concurrent.ForkJoinPool;
    1818
    19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    20 import net.trajano.commons.testing.UtilityClassTestUtil;
    2119import org.junit.jupiter.api.Disabled;
    2220import org.junit.jupiter.api.Test;
    23 import org.junit.jupiter.api.extension.RegisterExtension;
    2421import org.junit.jupiter.params.ParameterizedTest;
    2522import org.junit.jupiter.params.provider.ValueSource;
    26 import org.openstreetmap.josm.testutils.JOSMTestRules;
     23import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     24import org.openstreetmap.josm.testutils.annotations.I18n;
    2725import org.openstreetmap.josm.tools.UncheckedParseException;
     26
     27import net.trajano.commons.testing.UtilityClassTestUtil;
    2828
    2929/**
    3030 * Unit tests of {@link DateUtils} class.
    3131 */
     32@BasicPreferences
     33@I18n
    3234public class DateUtilsTest {
    33 
    34     /**
    35      * Set the timezone and timeout.
    36      * <p>
    37      * Timeouts need to be disabled because we change the time zone.
    38      */
    39     @RegisterExtension
    40     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    41     public JOSMTestRules test = new JOSMTestRules().i18n().preferences();
    42 
    4335    /**
    4436     * Tests that {@code DateUtils} satisfies utility class criteria.
  • trunk/test/unit/org/openstreetmap/josm/tools/date/IntervalTest.java

    r17845 r18870  
    22package org.openstreetmap.josm.tools.date;
    33
    4 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    5 import org.junit.jupiter.api.BeforeEach;
    6 import org.junit.jupiter.api.Test;
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    8 import org.openstreetmap.josm.testutils.JOSMTestRules;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    95
    106import java.time.Instant;
    117import java.util.Locale;
    128
    13 import static org.junit.jupiter.api.Assertions.assertEquals;
     9import org.junit.jupiter.api.BeforeEach;
     10import org.junit.jupiter.api.Test;
     11import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1412
     13@BasicPreferences
    1514class IntervalTest {
    16 
    17     /**
    18      * Setup test.
    19      */
    20     @RegisterExtension
    21     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules().preferences();
    23 
    2415    /**
    2516     * Setup test.
Note: See TracChangeset for help on using the changeset viewer.