Changeset 18870 in josm


Ignore:
Timestamp:
2023-10-16T15:19:07+02:00 (8 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
Files:
3 added
162 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java

    r18752 r18870  
    356356        ProjectionRegistry.setProjection(Projections.getProjectionByCode("epsg:3857".toUpperCase(Locale.ROOT)));
    357357
    358         Territories.initializeInternalData();
     358        if (Territories.getKnownIso3166Codes().isEmpty()) {
     359            Territories.initializeInternalData();
     360        }
    359361        OsmValidator.initialize();
    360362        MapPaintStyles.readFromPreferences();
  • trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

    r18553 r18870  
    458458                    List<Way> prims = Arrays.asList(es1.getWay(), es2.getWay());
    459459                    if ((highlight = crossingWays.get(prims)) == null) {
    460                         highlight = new ArrayList<>();
     460                        highlight = new ArrayList<>(2);
    461461                        highlight.add(es1);
    462462                        highlight.add(es2);
  • trunk/test/functional/org/openstreetmap/josm/data/BoundariesTestIT.java

    r18294 r18870  
    1212
    1313import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.openstreetmap.josm.data.osm.DataSet;
    1615import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1716import org.openstreetmap.josm.data.osm.search.SearchCompiler;
    1817import org.openstreetmap.josm.io.OsmReader;
    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 * Test of boundaries OSM file.
    2522 */
     23@BasicPreferences
    2624class BoundariesTestIT {
    2725
     
    4644            "US-PR", "US-RI", "US-SC", "US-SD", "US-TN", "US-TX", "US-UM", "US-UT", "US-VT", "US-VA", "US-VI", "US-WA", "US-WV", "US-WI",
    4745            "US-WY");
    48 
    49     /**
    50      * Setup test.
    51      */
    52     @RegisterExtension
    53     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    54     public JOSMTestRules test = new JOSMTestRules().preferences();
    5546
    5647    /**
  • trunk/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java

    r17275 r18870  
    77
    88import org.junit.jupiter.api.Test;
    9 import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Timeout;
    1010import org.openstreetmap.josm.spi.preferences.Config;
    11 import org.openstreetmap.josm.testutils.JOSMTestRules;
     11import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1212import org.openstreetmap.josm.tools.HttpClient;
    13 
    14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1513
    1614/**
     
    1816 * See <a href="https://josm.openstreetmap.de/wiki/ImageryCompare">JOSM wiki</a>
    1917 */
     18@BasicPreferences
     19@Timeout(60)
    2020class ImageryCompareTestIT {
    2121
    2222    private static final String BLACK_PREFIX = "<pre style=\"margin:3px;color:black\">";
    2323    private static final String RED_PREFIX = "<pre style=\"margin:3px;color:red\">";
    24 
    25     /**
    26      * Setup test.
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().preferences().timeout(60000);
    3124
    3225    /**
  • trunk/test/functional/org/openstreetmap/josm/data/osm/TaginfoTestIT.java

    r18723 r18870  
    1010import java.util.List;
    1111
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.Timeout;
     14import org.openstreetmap.josm.data.coor.LatLon;
     15import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
     16import org.openstreetmap.josm.data.validation.tests.TagChecker;
     17import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
     18import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
     19import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     20import org.openstreetmap.josm.tools.HttpClient;
     21
    1222import jakarta.json.Json;
    1323import jakarta.json.JsonObject;
     
    1525import jakarta.json.JsonValue;
    1626
    17 import org.junit.jupiter.api.Test;
    18 import org.junit.jupiter.api.extension.RegisterExtension;
    19 import org.openstreetmap.josm.data.coor.LatLon;
    20 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
    21 import org.openstreetmap.josm.data.validation.tests.TagChecker;
    22 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
    23 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
    24 import org.openstreetmap.josm.testutils.JOSMTestRules;
    25 import org.openstreetmap.josm.tools.HttpClient;
    26 import org.xml.sax.SAXException;
    27 
    28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    29 
    3027/**
    3128 * Various integration tests with Taginfo.
    3229 */
     30@BasicPreferences
     31@Timeout(20)
    3332class TaginfoTestIT {
    34 
    35     /**
    36      * Setup test.
    37      */
    38     @RegisterExtension
    39     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    40     public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000);
    41 
    4233    /**
    4334     * Checks that popular tags are known (i.e included in internal presets, or deprecated, or explicitely ignored)
    44      * @throws SAXException if any XML parsing error occurs
    4535     * @throws IOException if any I/O error occurs
    4636     * @throws ParseException if any MapCSS parsing error occurs
    4737     */
    4838    @Test
    49     void testCheckPopularTags() throws SAXException, IOException, ParseException {
     39    void testCheckPopularTags() throws IOException, ParseException {
    5040        TaggingPresets.readFromPreferences();
    5141        new TagChecker().initialize();
  • trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java

    r17276 r18870  
    2828import javax.imageio.ImageIO;
    2929
    30 import org.junit.jupiter.api.extension.RegisterExtension;
    3130import org.junit.jupiter.params.ParameterizedTest;
    3231import org.junit.jupiter.params.provider.MethodSource;
     
    4039import org.openstreetmap.josm.io.IllegalDataException;
    4140import org.openstreetmap.josm.io.OsmReader;
    42 import org.openstreetmap.josm.testutils.JOSMTestRules;
     41import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     42import org.openstreetmap.josm.testutils.annotations.Projection;
    4343import org.openstreetmap.josm.tools.ColorHelper;
    4444import org.openstreetmap.josm.tools.Utils;
    45 
    46 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    4745
    4846/**
     
    5250 * @author Michael Zangl
    5351 */
     52@BasicPreferences
     53@Projection
    5454public class MapCSSRendererTest {
    5555    private static final String TEST_DATA_BASE = "/renderer/";
     
    5959    private static final Bounds AREA_DEFAULT = new Bounds(0, 0, 1, 1);
    6060    private static final int IMAGE_SIZE = 256;
    61 
    62     /**
    63      * Minimal test rules required
    64      */
    65     @RegisterExtension
    66     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    67     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    6861
    6962    // development flag - set to true in order to update all reference images
  • trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java

    r17809 r18870  
    1010import java.awt.image.BufferedImage;
    1111import java.io.File;
     12import java.io.IOException;
    1213import java.io.InputStream;
    1314import java.util.IdentityHashMap;
    1415
    1516import org.junit.jupiter.api.AfterAll;
     17import org.junit.jupiter.api.BeforeAll;
    1618import org.junit.jupiter.api.BeforeEach;
    1719import org.junit.jupiter.api.Test;
    18 import org.junit.jupiter.api.extension.RegisterExtension;
     20import org.junit.jupiter.api.Timeout;
    1921import org.openstreetmap.josm.data.Bounds;
    2022import org.openstreetmap.josm.data.osm.DataSet;
     
    2729import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    2830import org.openstreetmap.josm.io.Compression;
     31import org.openstreetmap.josm.io.IllegalDataException;
    2932import org.openstreetmap.josm.io.OsmReader;
    30 import org.openstreetmap.josm.testutils.JOSMTestRules;
     33import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     34import org.openstreetmap.josm.testutils.annotations.Main;
     35import org.openstreetmap.josm.testutils.annotations.Projection;
    3136import org.openstreetmap.josm.tools.Pair;
    32 
    33 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3437
    3538/**
    3639 * Test {@link StyleCache}.
    3740 */
     41@BasicPreferences
     42@Main
     43@org.openstreetmap.josm.testutils.annotations.MapPaintStyles
     44@Projection
     45@Timeout(60)
    3846class StyleCacheTest {
    3947
     
    4755    private static DataSet dsCity2;
    4856
    49     /**
    50      * The test rules used for this test.
    51      */
    52     @RegisterExtension
    53     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    54     public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().mapStyles().timeout(60000);
     57    @BeforeAll
     58    static void beforeAll() throws IllegalDataException, IOException {
     59        try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) {
     60            dsCity = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
     61        }
     62        dsCity2 = new DataSet(dsCity);
     63    }
    5564
    5665    /**
     
    6170    public void load() throws Exception {
    6271        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
    63         try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) {
    64             dsCity = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
    65         }
    66         dsCity2 = new DataSet(dsCity);
    6772    }
    6873
     
    97102     * Verifies, that the intern pool is not growing when repeatedly rendering the
    98103     * same set of primitives (and clearing the calculated styles each time).
    99      *
     104     * <p>
    100105     * If it grows, this is an indication that the {@code equals} and {@code hashCode}
    101106     * implementation is broken and two identical objects are not recognized as equal
    102107     * or produce different hash codes.
    103      *
     108     * <p>
    104109     * The opposite problem (different objects are mistaken as equal) has more visible
    105110     * consequences for the user (wrong rendering on the map) and is not recognized by
     
    135140     * Verifies, that the number of {@code StyleElementList} instances stored
    136141     * for all the rendered primitives is actually low (as intended).
    137      *
     142     * <p>
    138143     * Two primitives with the same style should share one {@code StyleElementList}
    139144     * instance for the cached style elements. This is verified by counting all
  • trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java

    r18690 r18870  
    1717import org.junit.jupiter.api.Test;
    1818import org.junit.jupiter.api.Timeout;
    19 import org.junit.jupiter.api.extension.RegisterExtension;
    2019import org.openstreetmap.josm.PerformanceTestUtils;
    2120import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
    2221import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator;
    23 import org.openstreetmap.josm.testutils.JOSMTestRules;
     22import org.openstreetmap.josm.testutils.annotations.Projection;
    2423
    2524import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    2928 * @author Michael Zangl
    3029 */
     30@Projection
    3131@Timeout(value = 15, unit = TimeUnit.MINUTES)
    3232class KeyValuePerformanceTest {
     
    4040
    4141    /**
    42      * Prepare the test.
    43      */
    44     @RegisterExtension
    45     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    46     public JOSMTestRules test = new JOSMTestRules().projection();
    47 
    48     /**
    4942     * See if there is a big difference between Strings that are interned and those that are not.
    5043     */
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java

    r18690 r18870  
    1717import org.junit.jupiter.api.Test;
    1818import org.junit.jupiter.api.Timeout;
    19 import org.openstreetmap.josm.JOSMFixture;
    2019import org.openstreetmap.josm.PerformanceTestUtils;
    2120import org.openstreetmap.josm.data.Bounds;
     
    2524import org.openstreetmap.josm.io.Compression;
    2625import org.openstreetmap.josm.io.OsmReader;
     26import org.openstreetmap.josm.testutils.annotations.Projection;
     27import org.openstreetmap.josm.testutils.annotations.Territories;
    2728
    2829import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    3132 * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}.
    3233 */
     34@Projection
     35@Territories
    3336@Timeout(value = 15, unit = TimeUnit.MINUTES)
    3437abstract class AbstractMapRendererPerformanceTestParent {
     
    4952
    5053    protected static void load() throws Exception {
    51         JOSMFixture.createPerformanceTestFixture().init(true);
    5254        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
    5355        g = (Graphics2D) img.getGraphics();
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java

    r18690 r18870  
    1919import java.util.Locale;
    2020import java.util.Map;
     21import java.util.concurrent.TimeUnit;
    2122import java.util.stream.Collectors;
    2223
     
    2627import org.junit.jupiter.api.BeforeAll;
    2728import org.junit.jupiter.api.Test;
    28 import org.junit.jupiter.api.extension.RegisterExtension;
    29 import org.openstreetmap.josm.JOSMFixture;
     29import org.junit.jupiter.api.Timeout;
    3030import org.openstreetmap.josm.PerformanceTestUtils;
    3131import org.openstreetmap.josm.TestUtils;
     
    4444import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
    4545import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
    46 import org.openstreetmap.josm.testutils.JOSMTestRules;
     46import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     47import org.openstreetmap.josm.testutils.annotations.Main;
     48import org.openstreetmap.josm.testutils.annotations.Projection;
     49import org.openstreetmap.josm.testutils.annotations.Territories;
    4750
    4851import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    5154 * Performance test of map renderer.
    5255 */
     56@BasicPreferences
     57@Main
     58@Projection
     59@Territories
     60@Timeout(value = 15, unit = TimeUnit.MINUTES)
    5361public class MapRendererPerformanceTest {
    5462
     
    8290
    8391    /**
    84      * Setup tests
    85      */
    86     @RegisterExtension
    87     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    88     public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().preferences().timeout(15 * 60 * 1000);
    89 
    90     /**
    9192     * Initializes test environment.
    9293     * @throws Exception if any error occurs
     
    9495    @BeforeAll
    9596    public static void load() throws Exception {
    96         JOSMFixture.createPerformanceTestFixture().init(true);
    97 
    9897        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
    9998        g = (Graphics2D) img.getGraphics();
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java

    r17615 r18870  
    1111
    1212import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.BeforeAll;
    14 import org.openstreetmap.josm.JOSMFixture;
    1513import org.openstreetmap.josm.PerformanceTestUtils;
    1614import org.openstreetmap.josm.data.Bounds;
     
    2220import org.openstreetmap.josm.gui.mappaint.MapRendererPerformanceTest;
    2321import org.openstreetmap.josm.io.IllegalDataException;
     22import org.openstreetmap.josm.testutils.annotations.Projection;
    2423
    2524/**
     
    2827 *
    2928 */
     29@Projection
    3030class MapCSSPerformanceTest {
    3131
     
    4646                      "Please update configuration settings in the unit test file.");
    4747          }
    48     }
    49 
    50     /**
    51      * Setup test.
    52      */
    53     @BeforeAll
    54     public static void createJOSMFixture() {
    55         JOSMFixture.createPerformanceTestFixture().init(true);
    5648    }
    5749
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java

    r18690 r18870  
    44import java.util.concurrent.TimeUnit;
    55
    6 import org.junit.jupiter.api.BeforeAll;
    76import org.junit.jupiter.api.Test;
    87import org.junit.jupiter.api.Timeout;
    9 import org.openstreetmap.josm.JOSMFixture;
    108import org.openstreetmap.josm.PerformanceTestUtils;
    119import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
     
    1311import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator;
    1412import org.openstreetmap.josm.gui.mappaint.MultiCascade;
     13import org.openstreetmap.josm.testutils.annotations.Projection;
    1514
    1615/**
     
    1817 * @author Michael Zangl
    1918 */
     19@Projection
    2020@Timeout(value = 15, unit = TimeUnit.MINUTES)
    2121class MapCSSStyleSourceFilterTest {
     
    8282
    8383    /**
    84      * Prepare the test.
    85      */
    86     @BeforeAll
    87     public static void createJOSMFixture() {
    88         JOSMFixture.createPerformanceTestFixture().init(true);
    89     }
    90 
    91     /**
    9284     * Time how long it takes to evaluate [key=value] rules
    9385     */
  • 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.T