Changeset 17275 in josm


Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (4 weeks ago)
Author:
Don-vip
Message:

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

Location:
trunk/test
Files:
568 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/data/BoundariesTestIT.java

    r13412 r17275  
    22package org.openstreetmap.josm.data;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.io.InputStream;
     
    1111import java.util.stream.Collectors;
    1212
    13 import org.junit.Rule;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.data.osm.DataSet;
    1616import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2424 * Test of boundaries OSM file.
    2525 */
    26 public class BoundariesTestIT {
     26class BoundariesTestIT {
    2727
    2828    private static final List<String> RETIRED_ISO3166_1_CODES = Arrays.asList(
     
    5050     * Setup test.
    5151     */
    52     @Rule
     52    @RegisterExtension
    5353    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5454    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    5959     */
    6060    @Test
    61     public void testBoundariesFile() throws Exception {
     61    void testBoundariesFile() throws Exception {
    6262        try (InputStream is = getClass().getResourceAsStream("/data/boundaries.osm")) {
    6363            DataSet ds = OsmReader.parseDataSet(is, null);
     
    6767            for (String code : iso31661a2) {
    6868                if (!RETIRED_ISO3166_1_CODES.contains(code)) {
    69                     assertEquals(code, 1, tagged.stream().filter(SearchCompiler.compile("ISO3166-1\\:alpha2="+code)).count());
     69                    assertEquals(1, tagged.stream().filter(SearchCompiler.compile("ISO3166-1\\:alpha2="+code)).count(), code);
    7070                }
    7171            }
     
    7373            for (OsmPrimitive p : tagged.stream().filter(SearchCompiler.compile("ISO3166-1\\:alpha2")).collect(Collectors.toList())) {
    7474                String code = p.get("ISO3166-1:alpha2");
    75                 assertTrue(code, iso31661a2.contains(code) || EXCEPTIONNALY_RESERVED_ISO3166_1_CODES.contains(code));
     75                assertTrue(iso31661a2.contains(code) || EXCEPTIONNALY_RESERVED_ISO3166_1_CODES.contains(code), code);
    7676            }
    7777            // Check presence of all ISO-3166-2 codes for USA, Canada, Australia (for speed limits)
    7878            for (String code : ISO3166_2_CODES) {
    79                 assertEquals(code, 1, tagged.stream().filter(SearchCompiler.compile("ISO3166-2="+code)).count());
     79                assertEquals(1, tagged.stream().filter(SearchCompiler.compile("ISO3166-2="+code)).count(), code);
    8080            }
    8181        }
  • trunk/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java

    r16913 r17275  
    22package org.openstreetmap.josm.data.imagery;
    33
    4 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
    55
    66import java.net.URL;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
    1010import org.openstreetmap.josm.spi.preferences.Config;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1818 * See <a href="https://josm.openstreetmap.de/wiki/ImageryCompare">JOSM wiki</a>
    1919 */
    20 public class ImageryCompareTestIT {
     20class ImageryCompareTestIT {
    2121
    2222    private static final String BLACK_PREFIX = "<pre style=\"margin:3px;color:black\">";
     
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(60000);
     
    3535     */
    3636    @Test
    37     public void testImageryEntries() throws Exception {
     37    void testImageryEntries() throws Exception {
    3838        // Increase traditional timeouts to avoid random problems
    3939        Config.getPref().putInt("socket.timeout.connect", 60);
  • trunk/test/functional/org/openstreetmap/josm/data/osm/TaginfoTestIT.java

    r13103 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    66import java.io.IOException;
     
    1515import javax.json.JsonValue;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.data.coor.LatLon;
    2020import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
     
    3131 * Various integration tests with Taginfo.
    3232 */
    33 public class TaginfoTestIT {
     33class TaginfoTestIT {
    3434
    3535    /**
    3636     * Setup test.
    3737     */
    38     @Rule
     38    @RegisterExtension
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4040    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000);
     
    4747     */
    4848    @Test
    49     public void testCheckPopularTags() throws SAXException, IOException, ParseException {
     49    void testCheckPopularTags() throws SAXException, IOException, ParseException {
    5050        TaggingPresets.readFromPreferences();
    5151        new TagChecker().initialize();
     
    9090            System.err.println(error);
    9191        }
    92         assertTrue(errors.toString(), errors.isEmpty());
     92        assertTrue(errors.isEmpty(), errors::toString);
    9393    }
    9494}
  • trunk/test/functional/org/openstreetmap/josm/gui/GettingStartedTest.java

    r16910 r17275  
    22package org.openstreetmap.josm.gui;
    33
    4 import static org.junit.Assert.assertNotEquals;
     4import static org.junit.jupiter.api.Assertions.assertNotEquals;
    55
    66import java.io.IOException;
    77
    8 import org.junit.BeforeClass;
    9 import org.junit.Ignore;
    10 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.BeforeAll;
     10import org.junit.jupiter.api.Disabled;
    1111import org.openstreetmap.josm.JOSMFixture;
    1212
     
    1414 * Tests the {@link GettingStarted} class.
    1515 */
    16 public class GettingStartedTest {
     16class GettingStartedTest {
    1717
    1818    /**
    1919     * Setup test.
    2020     */
    21     @BeforeClass
     21    @BeforeAll
    2222    public static void init() {
    2323        JOSMFixture.createFunctionalTestFixture().init();
     
    3030     */
    3131    @Test
    32     @Ignore("see #15240, inactive for /browser/trunk/nodist/images/download.png")
    33     public void testImageReplacement() throws IOException {
     32    @Disabled("see #15240, inactive for /browser/trunk/nodist/images/download.png")
     33    void testImageReplacement() throws IOException {
    3434        final String motd = new GettingStarted.MotdContent().updateIfRequiredString();
    3535        // assuming that the MOTD contains one image included, fixImageLinks changes the HTML string
     
    4141     */
    4242    @Test
    43     public void testImageReplacementStatic() {
     43    void testImageReplacementStatic() {
    4444        final String html = "the download button <img src=\"/browser/trunk/resources/images/download.svg?format=raw\" " +
    4545                "alt=\"source:trunk/resources/images/download.svg\" title=\"source:trunk/resources/images/download.svg\" />.";
  • trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergerTestFT.java

    r16438 r17275  
    1313import org.openstreetmap.josm.data.osm.Way;
    1414
    15 public class NodeListMergerTestFT extends JFrame {
     15class NodeListMergerTestFT extends JFrame {
    1616
    1717    private NodeListMerger nodeListMerger;
     
    6262     * Constructs a new {@code NodeListMergerTest}.
    6363     */
    64     public NodeListMergerTestFT() {
     64    NodeListMergerTestFT() {
    6565        build();
    6666        populate();
  • trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergerTestFT.java

    r14120 r17275  
    1313import org.openstreetmap.josm.data.projection.Projections;
    1414
    15 public class PropertiesMergerTestFT extends JFrame {
     15class PropertiesMergerTestFT extends JFrame {
    1616
    1717    private PropertiesMerger merger;
     
    3838     * Constructs a new {@code PropertiesMergerTest}.
    3939     */
    40     public PropertiesMergerTestFT() {
     40    PropertiesMergerTestFT() {
    4141        build();
    4242        populate();
  • trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMergerTestFT.java

    r9546 r17275  
    1313import org.openstreetmap.josm.data.osm.Way;
    1414
    15 public class RelationMemberMergerTestFT extends JFrame {
     15class RelationMemberMergerTestFT extends JFrame {
    1616
    1717    private RelationMemberMerger merger;
     
    4242     * Constructs a new {@code RelationMemberMergerTest}.
    4343     */
    44     public RelationMemberMergerTestFT() {
     44    RelationMemberMergerTestFT() {
    4545        build();
    4646        populate();
  • trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergerTestFT.java

    r10378 r17275  
    66import javax.swing.JFrame;
    77
    8 public class TagMergerTestFT extends JFrame {
     8class TagMergerTestFT extends JFrame {
    99
    1010    private TagMerger tagMerger;
     
    1919     * Constructs a new {@code TagMergerTest}.
    2020     */
    21     public TagMergerTestFT() {
     21    TagMergerTestFT() {
    2222        build();
    2323        tagMerger.getModel().addItem(new TagMergeItem("key", "myvalue", "theirvalue"));
  • trunk/test/functional/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialogTestFT.java

    r10957 r17275  
    99import org.openstreetmap.josm.data.osm.Way;
    1010
    11 public class ConflictResolutionDialogTestFT extends JFrame {
     11class ConflictResolutionDialogTestFT extends JFrame {
    1212
    1313    private ConflictResolutionDialog dialog;
     
    3838     * Constructs a new {@code ConflictResolutionDialogTest}.
    3939     */
    40     public ConflictResolutionDialogTestFT() {
     40    ConflictResolutionDialogTestFT() {
    4141        build();
    4242    }
  • trunk/test/functional/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerTestFT.java

    r9546 r17275  
    44import javax.swing.JFrame;
    55
    6 public class ChangesetCacheManagerTestFT extends JFrame {
     6class ChangesetCacheManagerTestFT extends JFrame {
    77
    88    private ChangesetCacheManager manager;
  • trunk/test/functional/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialogTestFT.java

    r9546 r17275  
    44import javax.swing.JFrame;
    55
    6 public class ChangesetQueryDialogTestFT extends JFrame {
     6class ChangesetQueryDialogTestFT extends JFrame {
    77
    88    private ChangesetQueryDialog dialog;
  • trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTestFT.java

    r12620 r17275  
    66import javax.swing.JFrame;
    77
    8 import org.junit.BeforeClass;
     8import org.junit.jupiter.api.BeforeAll;
    99import org.openstreetmap.josm.JOSMFixture;
    1010import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    1717import org.openstreetmap.josm.tools.Logging;
    1818
    19 public class HistoryBrowserTestFT extends JFrame {
     19class HistoryBrowserTestFT extends JFrame {
    2020
    21     @BeforeClass
     21    @BeforeAll
    2222    public static void init() {
    2323        JOSMFixture.createFunctionalTestFixture().init();
     
    4949     * Constructs a new {@code HistoryBrowserTest}.
    5050     */
    51     public HistoryBrowserTestFT() {
     51    HistoryBrowserTestFT() {
    5252        build();
    5353        //populate(OsmPrimitiveType.NODE,354117);
    5454        //populate(OsmPrimitiveType.WAY,37951);
    5555        populate(OsmPrimitiveType.RELATION, 5055);
    56 
    5756    }
    5857
  • trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java

    r17002 r17275  
    22package org.openstreetmap.josm.gui.mappaint;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.fail;
     6import static org.junit.jupiter.api.Assumptions.assumeTrue;
    67
    78import java.awt.Color;
     
    2728import javax.imageio.ImageIO;
    2829
    29 import org.junit.Assume;
    30 import org.junit.Before;
    31 import org.junit.Rule;
    32 import org.junit.Test;
     30import org.junit.jupiter.api.BeforeEach;
     31import org.junit.jupiter.api.Test;
     32import org.junit.jupiter.api.extension.RegisterExtension;
    3333import org.junit.runner.RunWith;
    3434import org.junit.runners.Parameterized;
     
    6767     * Minimal test rules required
    6868     */
    69     @Rule
     69    @RegisterExtension
    7070    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    7171    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    181181     * @since 11691
    182182     */
    183     @Before
     183    @BeforeEach
    184184    public void forOpenJDK() {
    185185        String javaHome = System.getProperty("java.home");
    186         Assume.assumeTrue("Test requires openJDK", javaHome != null && javaHome.toLowerCase(Locale.ENGLISH).contains("openjdk"));
     186        assumeTrue(javaHome != null && javaHome.toLowerCase(Locale.ENGLISH).contains("openjdk"), "Test requires openJDK");
    187187
    188188        List<String> fonts = Arrays.asList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
    189189        for (String font : testConfig.fonts) {
    190             Assume.assumeTrue("Test requires font: " + font, fonts.contains(font));
     190            assumeTrue(fonts.contains(font), "Test requires font: " + font);
    191191        }
    192192    }
     
    197197     */
    198198    @Test
    199     public void testRender() throws Exception {
     199    void testRender() throws Exception {
    200200        // Force reset of preferences
    201201        StyledMapRenderer.PREFERENCE_ANTIALIASING_USE.put(true);
  • trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.gui.mappaint;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    57
    68import java.awt.Color;
     
    1113import java.util.IdentityHashMap;
    1214
    13 import org.junit.AfterClass;
    14 import org.junit.Assert;
    15 import org.junit.Before;
    16 import org.junit.BeforeClass;
    17 import org.junit.Rule;
    18 import org.junit.Test;
     15import org.junit.jupiter.api.AfterAll;
     16import org.junit.jupiter.api.BeforeAll;
     17import org.junit.jupiter.api.BeforeEach;
     18import org.junit.jupiter.api.Test;
     19import org.junit.jupiter.api.extension.RegisterExtension;
    1920import org.openstreetmap.josm.data.Bounds;
    2021import org.openstreetmap.josm.data.osm.DataSet;
     
    3637 * Test {@link StyleCache}.
    3738 */
    38 public class StyleCacheTest {
     39class StyleCacheTest {
    3940
    4041    private static final int IMG_WIDTH = 1400;
     
    5051     * The test rules used for this test.
    5152     */
    52     @Rule
     53    @RegisterExtension
    5354    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5455    public JOSMTestRules test = new JOSMTestRules().preferences().projection().mapStyles().timeout(60000);
     
    5859     * @throws Exception If an error occurred during load.
    5960     */
    60     @BeforeClass
     61    @BeforeAll
    6162    public static void load() throws Exception {
    6263        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
     
    7576     * Since we are running junit in non-forked mode, we don't know when this test will not be referenced any more.
    7677     */
    77     @AfterClass
     78    @AfterAll
    7879    public static void unload() {
    7980        g = null;
     
    8788     * Create the temporary graphics
    8889     */
    89     @Before
     90    @BeforeEach
    9091    public void loadGraphicComponents() {
    9192        g = (Graphics2D) img.getGraphics();
     
    110111     */
    111112    @Test
    112     public void testStyleCacheInternPool() {
     113    void testStyleCacheInternPool() {
    113114        MapPaintStyles.getStyles().clearCached();
    114115        StyleCache.clearStyleCachePool();
     
    130131                    }
    131132                }
    132                 assertEquals("intern pool size", internPoolSize.intValue(), newInternPoolSize);
     133                assertEquals(internPoolSize.intValue(), newInternPoolSize, "intern pool size");
    133134            }
    134135        }
     
    144145     */
    145146    @Test
    146     public void testStyleCacheInternPool2() {
     147    void testStyleCacheInternPool2() {
    147148        StyleCache.clearStyleCachePool();
    148149        Bounds bounds = new Bounds(53.56, 13.25, 53.57, 13.26);
     
    159160                Pair<StyleElementList, Range> p = osm.getCachedStyle().getWithRange(nc.getDist100Pixel(), false);
    160161                StyleElementList sel = p.a;
    161                 Assert.assertNotNull(sel);
     162                assertNotNull(sel);
    162163                Integer k = counter.get(sel);
    163164                if (k == null) {
     
    168169        }
    169170        int EXPECTED_NO_PRIMITIVES = 4294; // needs to be updated if data file or bbox changes
    170         Assert.assertEquals(
    171                 "The number of rendered primitives should be " + EXPECTED_NO_PRIMITIVES,
    172                 EXPECTED_NO_PRIMITIVES, noPrimitives);
    173         Assert.assertTrue(
    174                 "Too many StyleElementList instances, they should be shared using the StyleCache",
    175                 counter.size() < 100);
     171        assertEquals(EXPECTED_NO_PRIMITIVES, noPrimitives,
     172                "The number of rendered primitives should be " + EXPECTED_NO_PRIMITIVES);
     173        assertTrue(counter.size() < 100,
     174                "Too many StyleElementList instances, they should be shared using the StyleCache");
    176175    }
    177176}
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotNull;
    7 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assumptions.assumeTrue;
    89
    910import java.io.File;
     
    2425import java.util.logging.Logger;
    2526
    26 import org.junit.Assume;
    27 import org.junit.Before;
    28 import org.junit.BeforeClass;
    29 import org.junit.Rule;
    30 import org.junit.Test;
     27import org.junit.jupiter.api.BeforeAll;
     28import org.junit.jupiter.api.BeforeEach;
     29import org.junit.jupiter.api.Test;
     30import org.junit.jupiter.api.extension.RegisterExtension;
    3131import org.junit.rules.Timeout;
    3232import org.openstreetmap.josm.JOSMFixture;
     
    4343import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    4444import org.openstreetmap.josm.spi.preferences.Config;
     45import org.openstreetmap.josm.testutils.JOSMTestRules;
    4546
    4647import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    47 import org.openstreetmap.josm.testutils.JOSMTestRules;
    4848
    4949/**
     
    5151 */
    5252@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS")
    53 public class MultiFetchServerObjectReaderTest {
     53class MultiFetchServerObjectReaderTest {
    5454    private static final Logger logger = Logger.getLogger(MultiFetchServerObjectReader.class.getName());
    5555
     
    5757     * Setup test.
    5858     */
    59     @Rule
     59    @RegisterExtension
    6060    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6161    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    6464     * Global timeout applied to all test methods.
    6565     */
    66     @Rule
     66    @RegisterExtension
    6767    public Timeout globalTimeout = Timeout.seconds(60);
    6868
     
    161161     * @throws Exception if an error occurs
    162162     */
    163     @BeforeClass
     163    @BeforeAll
    164164    public static void init() throws Exception {
    165165        if (!TestUtils.areCredentialsProvided()) {
     
    215215     * @throws FileNotFoundException if the dataset file cannot be found
    216216     */
    217     @Before
     217    @BeforeEach
    218218    public void setUp() throws IOException, IllegalDataException, FileNotFoundException {
    219219        if (!TestUtils.areCredentialsProvided()) {
     
    233233     */
    234234    @Test
    235     public void testMultiGet10Nodes() throws OsmTransferException {
    236         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     235    void testMultiGet10Nodes() throws OsmTransferException {
     236        assumeTrue(TestUtils.areCredentialsProvided());
    237237        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    238238        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
     
    255255     */
    256256    @Test
    257     public void testMultiGet10Ways() throws OsmTransferException {
    258         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     257    void testMultiGet10Ways() throws OsmTransferException {
     258        assumeTrue(TestUtils.areCredentialsProvided());
    259259        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    260260        ArrayList<Way> ways = new ArrayList<>(ds.getWays());
     
    278278     */
    279279    @Test
    280     public void testMultiGet10Relations() throws OsmTransferException {
    281         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     280    void testMultiGet10Relations() throws OsmTransferException {
     281        assumeTrue(TestUtils.areCredentialsProvided());
    282282        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    283283        ArrayList<Relation> relations = new ArrayList<>(ds.getRelations());
     
    301301     */
    302302    @Test
    303     public void testMultiGet800Nodes() throws OsmTransferException {
    304         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     303    void testMultiGet800Nodes() throws OsmTransferException {
     304        assumeTrue(TestUtils.areCredentialsProvided());
    305305        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    306306        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
     
    323323     */
    324324    @Test
    325     public void testMultiGetWithNonExistingNode() throws OsmTransferException {
    326         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     325    void testMultiGetWithNonExistingNode() throws OsmTransferException {
     326        assumeTrue(TestUtils.areCredentialsProvided());
    327327        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    328328        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
     
    348348     */
    349349    @Test
    350     public void testBuildRequestString() {
     350    void testBuildRequestString() {
    351351        String requestString = new MultiFetchServerObjectReader()
    352352                .buildRequestString(OsmPrimitiveType.WAY, new TreeSet<>(Arrays.asList(130L, 123L, 126L)));
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r16442 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotNull;
    7 import static org.junit.Assert.assertTrue;
    8 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.fail;
     9import static org.junit.jupiter.api.Assumptions.assumeTrue;
    910
    1011import java.io.File;
     
    2223import java.util.logging.Logger;
    2324
    24 import org.junit.Assume;
    25 import org.junit.Before;
    26 import org.junit.BeforeClass;
    27 import org.junit.Test;
     25import org.junit.jupiter.api.BeforeAll;
     26import org.junit.jupiter.api.BeforeEach;
     27import org.junit.jupiter.api.Test;
    2828import org.openstreetmap.josm.JOSMFixture;
    2929import org.openstreetmap.josm.TestUtils;
     
    5252 */
    5353@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS")
    54 public class OsmServerBackreferenceReaderTest {
     54class OsmServerBackreferenceReaderTest {
    5555    private static final Logger logger = Logger.getLogger(OsmServerBackreferenceReader.class.getName());
    5656
     
    158158     * @throws IOException if an I/O error occurs
    159159     */
    160     @BeforeClass
     160    @BeforeAll
    161161    public static void setUpBeforeClass() throws OsmTransferException, CyclicUploadDependencyException, IOException {
    162162        if (!TestUtils.areCredentialsProvided()) {
     
    217217     * @throws FileNotFoundException if the dataset file cannot be found
    218218     */
    219     @Before
     219    @BeforeEach
    220220    public void setUp() throws IOException, IllegalDataException, FileNotFoundException {
    221221        if (!TestUtils.areCredentialsProvided()) {
     
    235235     */
    236236    @Test
    237     public void testBackreferenceForNode() throws OsmTransferException {
    238         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     237    void testBackreferenceForNode() throws OsmTransferException {
     238        assumeTrue(TestUtils.areCredentialsProvided());
    239239        Node n = lookupNode(ds, 0);
    240240        assertNotNull(n);
     
    291291     */
    292292    @Test
    293     public void testBackreferenceForNodeFull() throws OsmTransferException {
    294         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     293    void testBackreferenceForNodeFull() throws OsmTransferException {
     294        assumeTrue(TestUtils.areCredentialsProvided());
    295295        Node n = lookupNode(ds, 0);
    296296        assertNotNull(n);
     
    338338     */
    339339    @Test
    340     public void testBackreferenceForWay() throws OsmTransferException {
    341         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     340    void testBackreferenceForWay() throws OsmTransferException {
     341        assumeTrue(TestUtils.areCredentialsProvided());
    342342        Way w = lookupWay(ds, 1);
    343343        assertNotNull(w);
     
    381381     */
    382382    @Test
    383     public void testBackreferenceForWayFull() throws OsmTransferException {
    384         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     383    void testBackreferenceForWayFull() throws OsmTransferException {
     384        assumeTrue(TestUtils.areCredentialsProvided());
    385385        Way w = lookupWay(ds, 1);
    386386        assertNotNull(w);
     
    418418     */
    419419    @Test
    420     public void testBackreferenceForRelation() throws OsmTransferException {
    421         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     420    void testBackreferenceForRelation() throws OsmTransferException {
     421        assumeTrue(TestUtils.areCredentialsProvided());
    422422        Relation r = lookupRelation(ds, 1);
    423423        assertNotNull(r);
     
    536536     */
    537537    @Test
    538     public void testBackreferenceForRelationFull() throws OsmTransferException {
    539         Assume.assumeTrue(TestUtils.areCredentialsProvided());
     538    void testBackreferenceForRelationFull() throws OsmTransferException {
     539        assumeTrue(TestUtils.areCredentialsProvided());
    540540        Relation r = lookupRelation(ds, 1);
    541541        assertNotNull(r);
  • trunk/test/functional/org/openstreetmap/josm/io/UploadStrategySelectionPanelTest.java

    r12620 r17275  
    1212import javax.swing.JTextField;
    1313
    14 import org.junit.Ignore;
     14import org.junit.jupiter.api.Disabled;
    1515import org.openstreetmap.josm.gui.io.UploadStrategySelectionPanel;
    1616import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    1717import org.openstreetmap.josm.tools.Logging;
    1818
    19 @Ignore
    20 public class UploadStrategySelectionPanelTest extends JFrame {
     19@Disabled
     20class UploadStrategySelectionPanelTest extends JFrame {
    2121
    2222    protected UploadStrategySelectionPanel uploadStrategySelectionPanel;
     
    5656     * Constructs a new {@code UploadStrategySelectionPanelTest}.
    5757     */
    58     public UploadStrategySelectionPanelTest() {
     58    UploadStrategySelectionPanelTest() {
    5959        build();
    6060        uploadStrategySelectionPanel.setNumUploadedObjects(51000);
    6161    }
    6262
    63     public static void main(String[] args) throws OsmApiInitializationException, OsmTransferCanceledException {
     63    public static void main(String[] args) throws Exception {
    6464        OsmApi.getOsmApi().initialize(NullProgressMonitor.INSTANCE);
    6565        new UploadStrategySelectionPanelTest().setVisible(true);
  • trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java

    r17144 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotNull;
    74import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertNotNull;
    88import static org.openstreetmap.josm.gui.mappaint.MapCSSRendererTest.assertImageEquals;
    99
     
    4848 * Unit tests of {@link ImageProvider} class.
    4949 */
    50 public class ImageProviderTest {
     50class ImageProviderTest {
    5151
    5252    /**
     
    9494     */
    9595    @Test
    96     public void testTicket9984() throws IOException {
     96    void testTicket9984() throws IOException {
    9797        File file = new File(TestUtils.getRegressionDataFile(9984, "tile.png"));
    9898        assertEquals(Transparency.TRANSLUCENT, ImageProvider.read(file, true, true).getTransparency());
     
    108108     */
    109109    @Test
    110     public void testTicket10030() throws IOException {
     110    void testTicket10030() throws IOException {
    111111        File file = new File(TestUtils.getRegressionDataFile(10030, "tile.jpg"));
    112112        BufferedImage img = ImageProvider.read(file, true, true);
     
    120120    @Test
    121121    @SuppressFBWarnings(value = "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE")
    122     public void testTicket14319() throws IOException {
     122    void testTicket14319() throws IOException {
    123123        LogHandler14319 handler = new LogHandler14319();
    124124        Logger.getLogger(SVGConst.SVG_LOGGER).addHandler(handler);
     
    134134     */
    135135    @Test
    136     public void testTicket19551() throws SAXException {
     136    void testTicket19551() throws SAXException {
    137137        TaggingPreset badPreset = new TaggingPreset();
    138138        badPreset.setType("node,way,relation,closedway");
     
    155155     */
    156156    @Test
    157     public void testDataUrl() {
     157    void testDataUrl() {
    158158        // Red dot image, taken from https://en.wikipedia.org/wiki/Data_URI_scheme#HTML
    159159        assertNotNull(ImageProvider.get("data:image/png;base64," +
     
    167167     */
    168168    @Test
    169     public void testImageIcon() throws IOException {
     169    void testImageIcon() throws IOException {
    170170        ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource();
    171171        testImage(12, 9, "housenumber_small-AUTO-null", resource.getImageIcon());
     
    182182     */
    183183    @Test
    184     public void testImageIconBounded() throws IOException {
     184    void testImageIconBounded() throws IOException {
    185185        ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource();
    186186        testImage(8, 6, "housenumber_small-BOUNDED-08x08", resource.getImageIconBounded(new Dimension(8, 8)));
     
    194194     */
    195195    @Test
    196     public void testImageIconPadded() throws IOException {
     196    void testImageIconPadded() throws IOException {
    197197        ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource();
    198198        testImage(8, 8, "housenumber_small-PADDED-08x08", resource.getPaddedIcon(new Dimension(8, 8)));
     
    204204        final BufferedImage image = (BufferedImage) icon.getImage();
    205205        final File referenceFile = getReferenceFile(reference);
    206         assertEquals("width", width, image.getWidth(null));
    207         assertEquals("height", height, image.getHeight(null));
     206        assertEquals(width, image.getWidth(null), "width");
     207        assertEquals(height, image.getHeight(null), "height");
    208208        assertImageEquals(reference, referenceFile, image, 0, 0, null);
    209209    }
     
    219219     */
    220220    @Test
    221     public void testGetImageIconBounded() {
     221    void testGetImageIconBounded() {
    222222        int scale = 2;
    223223        GuiSizesHelper.setPixelDensity(scale);
     
    240240    /**
    241241     * Test getting an image for a crosshair cursor.
     242     * @param guiScale coefficient of monitor pixel density to be set
     243     * @throws IOException in case of I/O error
    242244     */
    243245    @ParameterizedTest
    244246    @ValueSource(floats = {1.0f, 1.5f, 3.0f})
    245     public void testGetCursorImageForCrosshair(float guiScale) throws IOException {
     247    void testGetCursorImageForCrosshair(float guiScale) throws IOException {
    246248        GuiSizesHelper.setPixelDensity(guiScale);
    247249        Point hotSpot = new Point();
     
    255257    /**
    256258     * Test getting an image for a custom cursor with overlay.
     259     * @param guiScale coefficient of monitor pixel density to be set
     260     * @throws IOException in case of I/O error
    257261     */
    258262    @ParameterizedTest
    259263    @ValueSource(floats = {1.0f, 1.5f, 3.0f})
    260     public void testGetCursorImageWithOverlay(float guiScale) throws IOException {
     264    void testGetCursorImageWithOverlay(float guiScale) throws IOException {
    261265        GuiSizesHelper.setPixelDensity(guiScale);
    262266        Point hotSpot = new Point();
  • trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTestIT.java

    r16983 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Integration tests of {@link ImageProvider} class.
    1414 */
    15 public class ImageProviderTestIT {
     15class ImageProviderTestIT {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testWikiProtocol() {
     28    void testWikiProtocol() {
    2929        // https://commons.wikimedia.org/wiki/File:OpenJDK_logo.svg
    3030        assertNotNull(ImageProvider.get("wiki://OpenJDK_logo.svg"));
  • trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTestManual.java

    r16983 r17275  
    1111import javax.swing.JPanel;
    1212
    13 import org.junit.Ignore;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.Disabled;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1616import org.openstreetmap.josm.testutils.JOSMTestRules;
    1717
     
    2121 * Unit tests of {@link ImageProvider} class for manual execution.
    2222 */
    23 public class ImageProviderTestManual {
     23class ImageProviderTestManual {
    2424
    2525    /**
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules();
     
    3232    /**
    3333     * Test getting a cursor
     34     * @throws InterruptedException in case of thread interruption
    3435     */
    35     @Ignore("manual execution only, as the look of the cursor cannot be checked automatedly")
     36    @Disabled("manual execution only, as the look of the cursor cannot be checked automatedly")
    3637    @Test
    37     public void testGetCursor() throws InterruptedException {
     38    void testGetCursor() throws InterruptedException {
    3839        JFrame frame = new JFrame();
    3940        frame.setSize(500, 500);
  • trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotSame;
    7 import static org.junit.Assert.assertSame;
    8 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotSame;
     7import static org.junit.jupiter.api.Assertions.assertSame;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    99
    1010import java.security.SecureRandom;
    1111import java.util.ArrayList;
    1212import java.util.Random;
     13import java.util.concurrent.TimeUnit;
    1314
    1415import org.apache.commons.lang3.RandomStringUtils;
    1516import org.junit.Before;
    16 import org.junit.Rule;
    17 import org.junit.Test;
    18 import org.junit.rules.Timeout;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.Timeout;
     19import org.junit.jupiter.api.extension.RegisterExtension;
    1920import org.openstreetmap.josm.PerformanceTestUtils;
    2021import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
     
    2829 * @author Michael Zangl
    2930 */
    30 public class KeyValuePerformanceTest {
     31@Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     32class KeyValuePerformanceTest {
    3133    private static final int PUT_RUNS = 10000;
    3234    private static final int GET_RUNS = 100000;
     
    3840
    3941    /**
    40      * Global timeout applied to all test methods.
    41      */
    42     @Rule
    43     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    44     public Timeout globalTimeout = Timeout.seconds(15*60);
    45 
    46     /**
    4742     * Prepare the test.
    4843     */
    49     @Rule
     44    @RegisterExtension
    5045    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5146    public JOSMTestRules test = new JOSMTestRules().projection();
     
    5651    @Test
    5752    @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test Strings that are interned and those that are not")
    58     public void testMeasureStringEqualsIntern() {
     53    void testMeasureStringEqualsIntern() {
    5954        String str1Interned = "string1";
    6055        String str1InternedB = "string1";
     
    134129     */
    135130    @Test
    136     public void testKeyValuePut() {
     131    void testKeyValuePut() {
    137132        for (double tagNodeRatio : TAG_NODE_RATIOS) {
    138133            int nodeCount = (int) (PUT_RUNS / tagNodeRatio);
     
    158153    @Test
    159154    @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
    160     public void testKeyValueGet() {
     155    void testKeyValueGet() {
    161156        for (double tagNodeRatio : TAG_NODE_RATIOS) {
    162157            KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio);
     
    179174     */
    180175    @Test
    181     public void testKeyValueGetKeys() {
     176    void testKeyValueGetKeys() {
    182177        for (double tagNodeRatio : TAG_NODE_RATIOS) {
    183178            KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio);
     
    202197    @Test
    203198    @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
    204     public void testKeyValueGetKeysGet() {
     199    void testKeyValueGetKeysGet() {
    205200        for (double tagNodeRatio : TAG_NODE_RATIOS) {
    206201            KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio);
  • trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java

    r10758 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    6 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
    77import org.openstreetmap.josm.data.coor.LatLon;
    88import org.openstreetmap.josm.data.coor.LatLonTest;
     
    1313 * Checks that rounding of coordinates is not too slow.
    1414 */
    15 public class RoundingPerformanceTest {
     15class RoundingPerformanceTest {
    1616
    1717    private static double oldRoundToOsmPrecision(double value) {
     
    2525    @Test
    2626    @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
    27     public void testRounding() {
     27    void testRounding() {
    2828        final int n = 1000000;
    2929        long start = System.nanoTime();
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java

    r16006 r17275  
    1111import java.nio.file.Files;
    1212import java.nio.file.Paths;
     13import java.util.concurrent.TimeUnit;
    1314
    1415import javax.imageio.ImageIO;
    1516
    16 import org.junit.Rule;
    17 import org.junit.Test;
    18 import org.junit.rules.Timeout;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.Timeout;
    1919import org.openstreetmap.josm.JOSMFixture;
    2020import org.openstreetmap.josm.data.Bounds;
     
    3030 * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}.
    3131 */
    32 public abstract class AbstractMapRendererPerformanceTestParent {
     32@Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     33abstract class AbstractMapRendererPerformanceTestParent {
    3334
    3435    private static final int IMG_WIDTH = 1400;
     
    4546    private static DataSet dsOverpass;
    4647    private static DataSet dsCity;
    47 
    48     /**
    49      * Global timeout applied to all test methods.
    50      */
    51     @Rule
    52     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    53     public Timeout globalTimeout = Timeout.seconds(15*60);
    5448
    5549    protected static void load() throws Exception {
     
    112106
    113107    @Test
    114     public void testRestriction() throws Exception {
     108    void testRestriction() throws Exception {
    115109        test(700, dsRestriction, new Bounds(51.12, 14.147472381591795, 51.128, 14.162492752075195));
    116110    }
    117111
    118112    @Test
    119     public void testRestrictionSmall() throws Exception {
     113    void testRestrictionSmall() throws Exception {
    120114        test(1500, dsRestriction, new Bounds(51.125, 14.147, 51.128, 14.152));
    121115    }
    122116
    123117    @Test
    124     public void testMultipolygon() throws Exception {
     118    void testMultipolygon() throws Exception {
    125119        test(400, dsMultipolygon, new Bounds(60, -180, 85, -122));
    126120    }
    127121
    128122    @Test
    129     public void testMultipolygonSmall() throws Exception {
     123    void testMultipolygonSmall() throws Exception {
    130124        test(850, dsMultipolygon, new Bounds(-90, -180, 90, 180));
    131125    }
     
    135129     * Complex polygon (Lake Ontario) with small download area.
    136130     */
    137     public void testOverpassDownload() throws Exception {
     131    void testOverpassDownload() throws Exception {
    138132        test(20, dsOverpass, new Bounds(43.4510496, -76.536684, 43.4643202, -76.4954853));
    139133    }
    140134
    141135    @Test
    142     public void testCity() throws Exception {
     136    void testCity() throws Exception {
    143137        test(50, dsCity, new Bounds(53.51, 13.20, 53.59, 13.34));
    144138    }
    145139
    146140    @Test
    147     public void testCitySmall() throws Exception {
     141    void testCitySmall() throws Exception {
    148142        test(70, dsCity, new Bounds(52, 11, 55, 14));
    149143    }
    150144
    151145    @Test
    152     public void testCityPart1() throws Exception {
     146    void testCityPart1() throws Exception {
    153147        test(250, dsCity, new Bounds(53.56, 13.25, 53.57, 13.26));
    154148    }
    155149
    156150    @Test
    157     public void testCityPart2() throws Exception {
     151    void testCityPart2() throws Exception {
    158152        test(200, dsCity, new Bounds(53.55, 13.29, 53.57, 13.30));
    159153    }
    160154
    161155    @Test
    162     public void testCitySmallPart2() throws Exception {
     156    void testCitySmallPart2() throws Exception {
    163157        test(200, dsCity, new Bounds(53.56, 13.295, 53.57, 13.30));
    164158    }
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java

    r10907 r17275  
    77import javax.imageio.ImageIO;
    88
    9 import org.junit.AfterClass;
    10 import org.junit.BeforeClass;
     9import org.junit.jupiter.api.AfterAll;
     10import org.junit.jupiter.api.BeforeAll;
    1111import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    1212
     
    1616 * Performance test of {@code StyledMapRenderer}.
    1717 */
    18 public class StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {
     18class StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {
    1919
    20     @BeforeClass
     20    @BeforeAll
    2121    public static void load() throws Exception {
    2222        AbstractMapRendererPerformanceTestParent.load();
     
    2525    }
    2626
    27     @AfterClass
     27    @AfterAll
    2828    public static void clean() throws Exception {
    2929        AbstractMapRendererPerformanceTestParent.clean();
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRendererPerformanceTest.java

    r10907 r17275  
    22package org.openstreetmap.josm.data.osm.visitor.paint;
    33
    4 import org.junit.AfterClass;
    5 import org.junit.BeforeClass;
     4import org.junit.jupiter.api.AfterAll;
     5import org.junit.jupiter.api.BeforeAll;
    66
    77/**
    88 * Performance test of {@code WireframeMapRenderer}.
    99 */
    10 public class WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {
     10class WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {
    1111
    12     @BeforeClass
     12    @BeforeAll
    1313    public static void load() throws Exception {
    1414        AbstractMapRendererPerformanceTestParent.load();
    1515    }
    1616
    17     @AfterClass
     17    @AfterAll
    1818    public static void clean() throws Exception {
    1919        AbstractMapRendererPerformanceTestParent.clean();
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java

    r16822 r17275  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.mappaint;
     3
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    35
    46import java.awt.Color;
     
    2022import javax.imageio.ImageIO;
    2123
    22 import org.junit.AfterClass;
    2324import org.junit.Assert;
    24 import org.junit.BeforeClass;
    25 import org.junit.Rule;
    26 import org.junit.Test;
     25import org.junit.jupiter.api.AfterAll;
     26import org.junit.jupiter.api.BeforeAll;
     27import org.junit.jupiter.api.Test;
     28import org.junit.jupiter.api.extension.RegisterExtension;
    2729import org.openstreetmap.josm.JOSMFixture;
    2830import org.openstreetmap.josm.PerformanceTestUtils;
     
    4951import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    5052
    51 import static org.junit.Assert.assertEquals;
    52 
    5353/**
    5454 * Performance test of map renderer.
     
    8787     * Setup tests
    8888     */
    89     @Rule
     89    @RegisterExtension
    9090    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    9191    public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().preferences().timeout(15 * 60 * 1000);
     
    9595     * @throws Exception if any error occurs
    9696     */
    97     @BeforeClass
     97    @BeforeAll
    9898    public static void load() throws Exception {
    9999        JOSMFixture.createPerformanceTestFixture().init(true);
     
    179179     * Cleanup test environment.
    180180     */
    181     @AfterClass
     181    @AfterAll
    182182    public static void cleanUp() {
    183183        setFilterStyleActive(false);
     
    283283     */
    284284    @Test
    285     public void testPerformanceGenerate() throws IOException {
     285    void testPerformanceGenerate() throws IOException {
    286286        setFilterStyleActive(false);
    287287        PerformanceTester test = new PerformanceTester();
     
    322322     */
    323323    @Test
    324     public void testPerformanceDrawFeatures() throws IOException {
     324    void testPerformanceDrawFeatures() throws IOException {
    325325        testDrawFeature(null);
    326326        for (Feature f : Feature.values()) {
     
    352352    }
    353353
    354     public static class BenchmarkData extends CapturingBenchmark {
     354    static class BenchmarkData extends CapturingBenchmark {
    355355
    356356        private List<StyleRecord> allStyleElems;
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSConditionPerformanceTest.java

    r10837 r17275  
    44import java.util.EnumSet;
    55
    6 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
    77import org.openstreetmap.josm.PerformanceTestUtils;
    88import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
     
    1212 * @author Michael Zangl
    1313 */
    14 public class MapCSSConditionPerformanceTest {
     14class MapCSSConditionPerformanceTest {
    1515    /**
    1616     * Test the performance of all OP entries.
    1717     */
    1818    @Test
    19     public void testAllOps() {
     19    void testAllOps() {
    2020        // The JIT does some really heavy optimisations if it notices that other values are not used.
    2121        // If we want to simulate a real scenario, we need to invoke every op several times to let the compiler
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    33
    4 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
    55
    66import java.awt.Graphics2D;
     
    1010import java.util.Collection;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.BeforeAll;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.data.Bounds;
     
    2929 *
    3030 */
    31 public class MapCSSPerformanceTest {
     31class MapCSSPerformanceTest {
    3232
    3333    /* ------------------------ configuration section  ---------------------------- */
     
    5656     * Setup test.
    5757     */
    58     @BeforeClass
     58    @BeforeAll
    5959    public static void createJOSMFixture() {
    6060        JOSMFixture.createPerformanceTestFixture().init(true);
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    33
    4 import org.junit.BeforeClass;
    5 import org.junit.Rule;
    6 import org.junit.Test;
    7 import org.junit.rules.Timeout;
     4import java.util.concurrent.TimeUnit;
     5
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.Timeout;
    89import org.openstreetmap.josm.JOSMFixture;
    910import org.openstreetmap.josm.PerformanceTestUtils;
     
    1314import org.openstreetmap.josm.gui.mappaint.MultiCascade;
    1415
    15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    16 
    1716/**
    1817 * Tests how fast {@link MapCSSStyleSource} finds the right style candidates for one object.
    1918 * @author Michael Zangl
    2019 */
    21 public class MapCSSStyleSourceFilterTest {
     20@Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     21class MapCSSStyleSourceFilterTest {
    2222
    2323    private static final int TEST_RULE_COUNT = 10000;
     
    8282
    8383    /**
    84      * Global timeout applied to all test methods.
    85      */
    86     @Rule
    87     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    88     public Timeout globalTimeout = Timeout.seconds(15*60);
    89 
    90     /**
    9184     * Prepare the test.
    9285     */
    93     @BeforeClass
     86    @BeforeAll
    9487    public static void createJOSMFixture() {
    9588        JOSMFixture.createPerformanceTestFixture().init(true);
     
    10093     */
    10194    @Test
    102     public void testKeyValueRules() {
     95    void testKeyValueRules() {
    10396        KeyValueDataGenerator data = OsmDataGenerator.getKeyValue();
    10497        data.generateDataSet();
     
    111104     */
    112105    @Test
    113     public void testKeyOnlyRules() {
     106    void testKeyOnlyRules() {
    114107        KeyValueDataGenerator data = OsmDataGenerator.getKeyValue();
    115108        data.generateDataSet();
     
    122115     */
    123116    @Test
    124     public void testRegularExpressionRules() {
     117    void testRegularExpressionRules() {
    125118        KeyValueDataGenerator data = OsmDataGenerator.getKeyValue();
    126119        data.generateDataSet();
     
    133126     */
    134127    @Test
    135     public void testIsTrueRules() {
     128    void testIsTrueRules() {
    136129        KeyValueDataGenerator data = OsmDataGenerator.getKeyValue();
    137130        data.generateDataSet();
  • trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    66import java.io.ByteArrayInputStream;
     
    1010import java.io.IOException;
    1111import java.io.InputStream;
     12import java.util.concurrent.TimeUnit;
    1213
    13 import org.junit.BeforeClass;
    14 import org.junit.Rule;
    15 import org.junit.Test;
    16 import org.junit.rules.Timeout;
     14import org.junit.jupiter.api.BeforeAll;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.Timeout;
    1717import org.openstreetmap.josm.JOSMFixture;
    1818import org.openstreetmap.josm.PerformanceTestUtils;
    1919import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
    2020import org.openstreetmap.josm.data.osm.DataSet;
    21 
    22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2321
    2422/**
     
    2927 * @author Michael Zangl
    3028 */
    31 public class OsmReaderPerformanceTest {
     29@Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     30class OsmReaderPerformanceTest {
    3231    private static final int TIMES = 4;
    3332    private static final String DATA_FILE = "nodist/data/neubrandenburg.osm.bz2";
    3433
    3534    /**
    36      * Global timeout applied to all test methods.
    37      */
    38     @Rule
    39     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    40     public Timeout globalTimeout = Timeout.seconds(15*60);
    41 
    42     /**
    4335     * Prepare the test.
    4436     */
    45     @BeforeClass
     37    @BeforeAll
    4638    public static void createJOSMFixture() {
    4739        JOSMFixture.createPerformanceTestFixture().init(true);
     
    5345     */
    5446    @Test
    55     public void testCompressed() throws Exception {
     47    void testCompressed() throws Exception {
    5648        runTest("compressed (.osm.bz2)", false);
    5749    }
     
    6254     */
    6355    @Test
    64     public void testPlain() throws Exception {
     56    void testPlain() throws Exception {
    6557        runTest(".osm-file", true);
    6658    }
  • trunk/test/unit/org/CustomMatchers.java

    r16634 r17275  
    1212import org.hamcrest.Matcher;
    1313import org.hamcrest.TypeSafeMatcher;
    14 import org.junit.Ignore;
     14import org.junit.jupiter.api.Disabled;
    1515import org.openstreetmap.josm.data.Bounds;
    1616import org.openstreetmap.josm.data.coor.EastNorth;
     
    2020 * Custom matchers for unit tests.
    2121 */
    22 @Ignore("no test")
     22@Disabled("no test")
    2323public final class CustomMatchers {
    2424
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r15233 r17275  
    22package org.openstreetmap.josm;
    33
    4 import static org.junit.Assert.assertNull;
    5 import static org.junit.Assert.assertTrue;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertNull;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.io.File;
  • trunk/test/unit/org/openstreetmap/josm/TestUtils.java

    r17198 r17275  
    22package org.openstreetmap.josm;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertTrue;
    7 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.fail;
     8import static org.junit.jupiter.api.Assumptions.assumeFalse;
    89
    910import java.awt.Component;
     
    3435import java.util.stream.Stream;
    3536
    36 import org.junit.Assert;
    37 import org.junit.Assume;
     37import org.junit.jupiter.api.Assertions;
    3838import org.openstreetmap.josm.command.Command;
    3939import org.openstreetmap.josm.data.osm.DataSet;
     
    447447     * Use to assume that EqualsVerifier is working with the current JVM.
    448448     */
     449    @SuppressWarnings("null")
    449450    public static void assumeWorkingEqualsVerifier() {
    450451        if (Utils.getJavaVersion() >= 16) {
     
    457458            nl.jqno.equalsverifier.internal.lib.bytebuddy.ClassFileVersion.ofThisVm();
    458459        } catch (IllegalArgumentException e) {
    459             Assume.assumeNoException(e);
     460            assumeFalse(e != null);
    460461        }
    461462    }
     
    464465     * Use to assume that JMockit is working with the current JVM.
    465466     */
     467    @SuppressWarnings("null")
    466468    public static void assumeWorkingJMockit() {
    467469        try {
     
    471473            new JOptionPaneSimpleMocker();
    472474        } catch (UnsupportedOperationException e) {
    473             Assume.assumeNoException(e);
     475            assumeFalse(e != null);
    474476        } finally {
    475477            TestRunnerDecorator.cleanUpAllMocks();
     
    546548    /**
    547549     * Replaces {@linkplain System#lineSeparator() system dependent line separators} with {@code \n}
    548      * and calls {@link Assert#assertEquals(java.lang.Object, java.lang.Object)}.
     550     * and calls {@link Assertions#assertEquals(java.lang.Object, java.lang.Object)}.
    549551     * @param expected expected value
    550552     * @param actual the value to check against <code>expected</code>
  • trunk/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java

    r14822 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests for class {@link AboutAction}.
    1414 */
    15 public final class AboutActionTest {
     15final class AboutActionTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().main();
     
    2626     */
    2727    @Test
    28     public void testBuildAboutPanel() {
     28    void testBuildAboutPanel() {
    2929        assertNotNull(new AboutAction().buildAboutPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java

    r13108 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertNull;
    7 
    8 import org.junit.Before;
    9 import org.junit.Rule;
    10 import org.junit.Test;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertThrows;
     8
     9import org.junit.jupiter.api.BeforeEach;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1112import org.openstreetmap.josm.actions.AlignInLineAction.InvalidSelection;
    1213import org.openstreetmap.josm.actions.AlignInLineAction.Line;
     
    2425 * Unit tests for class {@link AlignInLineAction}.
    2526 */
    26 public final class AlignInLineActionTest {
     27final class AlignInLineActionTest {
    2728
    2829    /**
    2930     * Setup test.
    3031     */
    31     @Rule
     32    @RegisterExtension
    3233    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3334    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    3940     * Setup test.
    4041     */
    41     @Before
     42    @BeforeEach
    4243    public void setUp() {
    4344        // Enable "Align in line" feature.
     
    5455     */
    5556    @Test
    56     public void testNodesOpenWay() throws InvalidSelection {
     57    void testNodesOpenWay() throws InvalidSelection {
    5758        DataSet dataSet = new DataSet();
    5859
     
    8687     */
    8788    @Test
    88     public void testNodesClosedWay() throws InvalidSelection {
     89    void testNodesClosedWay() throws InvalidSelection {
    8990        DataSet dataSet = new DataSet();
    9091
     
    119120     */
    120121    @Test
    121     public void testNodesOpenWays() throws InvalidSelection {
     122    void testNodesOpenWays() throws InvalidSelection {
    122123        DataSet dataSet = new DataSet();
    123124
     
    153154     */
    154155    @Test
    155     public void testSimpleWay() throws InvalidSelection {
     156    void testSimpleWay() throws InvalidSelection {
    156157        DataSet dataSet = new DataSet();
    157158
     
    200201    private void assertCoordEq(Node node, double x, double y) {
    201202        EastNorth coordinate = node.getEastNorth();
    202         assertEquals("Wrong x coordinate.", x, coordinate.getX(), LatLon.MAX_SERVER_PRECISION);
    203         assertEquals("Wrong y coordinate.", y, coordinate.getY(), LatLon.MAX_SERVER_PRECISION);
     203        assertEquals(x, coordinate.getX(), LatLon.MAX_SERVER_PRECISION, "Wrong x coordinate.");
     204        assertEquals(y, coordinate.getY(), LatLon.MAX_SERVER_PRECISION, "Wrong y coordinate.");
    204205    }
    205206
     
    209210     */
    210211    @Test
    211     public void testLineDifferentCoordinates() throws InvalidSelection {
     212    void testLineDifferentCoordinates() throws InvalidSelection {
    212213        assertNotNull(new Line(new Node(new EastNorth(0, 1)),
    213214                               new Node(new EastNorth(0, 2))));
     
    222223     * @throws InvalidSelection always
    223224     */
    224     @Test(expected = InvalidSelection.class)
    225     public void testLineSameCoordinates1() throws InvalidSelection {
    226         new Line(new Node(new EastNorth(0, 1)),
    227                  new Node(new EastNorth(0, 1)));
     225    @Test
     226    void testLineSameCoordinates1() throws InvalidSelection {
     227        assertThrows(InvalidSelection.class, () -> new Line(new Node(new EastNorth(0, 1)),
     228                 new Node(new EastNorth(0, 1))));
    228229    }
    229230
     
    232233     * @throws InvalidSelection always
    233234     */
    234     @Test(expected = InvalidSelection.class)
    235     public void testLineSameCoordinates2() throws InvalidSelection {
    236         new Line(new Node(new EastNorth(0, 1)),
    237                  new Node(new EastNorth(0+1e-175, 1+1e-175)));
     235    @Test
     236    void testLineSameCoordinates2() throws InvalidSelection {
     237        assertThrows(InvalidSelection.class, () -> new Line(new Node(new EastNorth(0, 1)),
     238                 new Node(new EastNorth(0+1e-175, 1+1e-175))));
    238239    }
    239240}
  • trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java

    r16438 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
    66
    77import java.io.IOException;
     
    1515import java.util.Set;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.extension.RegisterExtension;
     18import org.junit.jupiter.api.Test;
    1919import org.openstreetmap.josm.TestUtils;
    2020import org.openstreetmap.josm.data.osm.DataSet;
     
    3232 * Unit tests for class {@link CombineWayAction}.
    3333 */
    34 public class CombineWayActionTest {
     34class CombineWayActionTest {
    3535
    3636    /**
    3737     * Setup test.
    3838     */
    39     @Rule
     39    @RegisterExtension
    4040    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4141    public JOSMTestRules test = new JOSMTestRules();
     
    4747     */
    4848    @Test
    49     public void testTicket11957() throws IOException, IllegalDataException {
     49    void testTicket11957() throws IOException, IllegalDataException {
    5050        try (InputStream is = TestUtils.getRegressionDataStream(11957, "data.osm")) {
    5151            DataSet ds = OsmReader.parseDataSet(is, null);
     
    6868     */
    6969    @Test
    70     public void testTicket18385() throws IOException, IllegalDataException {
     70    void testTicket18385() throws IOException, IllegalDataException {
    7171        try (InputStream is = TestUtils.getRegressionDataStream(18385, "data.osm")) {
    7272            DataSet ds = OsmReader.parseDataSet(is, null);
     
    8282     */
    8383    @Test
    84     public void testTicket18387() throws IOException, IllegalDataException {
     84    void testTicket18387() throws IOException, IllegalDataException {
    8585        try (InputStream is = TestUtils.getRegressionDataStream(18387, "data.osm")) {
    8686            DataSet ds = OsmReader.parseDataSet(is, null);
     
    104104     */
    105105    @Test
    106     public void testTicket18367() throws IOException, IllegalDataException {
     106    void testTicket18367() throws IOException, IllegalDataException {
    107107        try (InputStream is = TestUtils.getRegressionDataStream(18367, "nocombine.osm")) {
    108108            DataSet ds = OsmReader.parseDataSet(is, null);
     
    125125     */
    126126    @Test
    127     public void testTicket18367NeedsSplit() throws IOException, IllegalDataException {
     127    void testTicket18367NeedsSplit() throws IOException, IllegalDataException {
    128128        try (InputStream is = TestUtils.getRegressionDataStream(18367, "split-and-reverse.osm")) {
    129129            DataSet ds = OsmReader.parseDataSet(is, null);
     
    149149     */
    150150    @Test
    151     public void testDetectReversedWays() throws IOException, IllegalDataException {
     151    void testDetectReversedWays() throws IOException, IllegalDataException {
    152152        try (InputStream is = TestUtils.getRegressionDataStream(18367, "silent-revert.osm")) {
    153153            DataSet ds = OsmReader.parseDataSet(is, null);
     
    175175     */
    176176    @Test
    177     public void testEqualsContract() {
     177    void testEqualsContract() {
    178178        TestUtils.assumeWorkingEqualsVerifier();
    179179        EqualsVerifier.forClass(NodePair.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotNull;
    7 import static org.junit.Assert.assertTrue;
    8 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.fail;
    99
    1010import java.awt.datatransfer.Clipboard;
     
    1515import java.util.Arrays;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.data.coor.LatLon;
    2020import org.openstreetmap.josm.data.osm.DataSet;
     
    3232 * Unit tests for class {@link CopyAction}.
    3333 */
    34 public class CopyActionTest {
     34class CopyActionTest {
    3535    private static final class CapturingCopyAction extends CopyAction {
    3636        private boolean warningShown;
     
    4545     * We need prefs for this.
    4646     */
    47     @Rule
     47    @RegisterExtension
    4848    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4949    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
     
    5555     */
    5656    @Test
    57     public void testWarnOnEmpty() throws UnsupportedFlavorException, IOException {
     57    void testWarnOnEmpty() throws UnsupportedFlavorException, IOException {
    5858        Clipboard clipboard = ClipboardUtils.getClipboard();
    5959        clipboard.setContents(new StringSelection("test"), null);
     
    8282     */
    8383    @Test
    84     public void testCopySinglePrimitive() throws Exception {
     84    void testCopySinglePrimitive() throws Exception {
    8585        DataSet data = new DataSet();
    8686
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java

    r14977 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertSame;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertSame;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.lang.reflect.Field;
     
    99import java.util.Collection;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.data.coor.EastNorth;
    1414import org.openstreetmap.josm.data.coor.LatLon;
     
    2929 * Unit tests for class {@link CreateCircleAction}.
    3030 */
    31 public final class CreateCircleActionTest {
     31final class CreateCircleActionTest {
    3232
    3333    /**
    3434     * Setup test.
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules().projection();
     
    4545     */
    4646    @Test
    47     public void testTicket7421case0() throws ReflectiveOperationException {
     47    void testTicket7421case0() throws ReflectiveOperationException {
    4848        DataSet dataSet = new DataSet();
    4949
     
    6565        // Expected result: Dataset contain one closed way, clockwise
    6666        Collection<Way> resultingWays = dataSet.getWays();
    67         assertSame(String.format("Expect one way after perform action. %d found", resultingWays.size()),
    68                    resultingWays.size(), 1);
     67        assertSame(1, resultingWays.size(), String.format("Expect one way after perform action. %d found", resultingWays.size()));
    6968        Way resultingWay = resultingWays.iterator().next();
    70         assertTrue("Resulting way is not closed",
    71                    resultingWay.isClosed());
    72         assertTrue("Found anti-clockwize circle while way was clockwize",
    73                    Geometry.isClockwise(resultingWay));
     69        assertTrue(resultingWay.isClosed(), "Resulting way is not closed");
     70        assertTrue(Geometry.isClockwise(resultingWay), "Found anti-clockwise circle while way was clockwise");
    7471    }
    7572
     
    10299     */
    103100    @Test
    104     public void testTicket7421case1() throws ReflectiveOperationException {
     101    void testTicket7421case1() throws ReflectiveOperationException {
    105102        DataSet dataSet = new DataSet();
    106103
     
    127124            // Expected result: Dataset contain one closed way, clockwise
    128125            Collection<Way> resultingWays = dataSet.getWays();
    129             assertSame(String.format("Expect one way after perform action. %d found", resultingWays.size()),
    130                        resultingWays.size(), 1);
     126            assertSame(1, resultingWays.size(), String.format("Expect one way after perform action. %d found", resultingWays.size()));
    131127            Way resultingWay = resultingWays.iterator().next();
    132             assertTrue("Resulting way is not closed",
    133                        resultingWay.isClosed());
    134             assertTrue("Found anti-clockwise way while traffic is left hand.",
    135                        Geometry.isClockwise(resultingWay));
     128            assertTrue(resultingWay.isClosed(), "Resulting way is not closed");
     129            assertTrue(Geometry.isClockwise(resultingWay), "Found anti-clockwise way while traffic is left hand.");
    136130        } finally {
    137131            // Restore left/right hand traffic database
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java

    r15162 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.nio.file.Files;
     
    1212import java.util.TreeMap;
    1313
    14 import org.junit.Rule;
    15 import org.junit.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
     15import org.junit.jupiter.api.Test;
    1616import org.openstreetmap.josm.TestUtils;
    1717import org.openstreetmap.josm.command.SequenceCommand;
     
    3737 * Unit test of {@link CreateMultipolygonAction}
    3838 */
    39 public class CreateMultipolygonActionTest {
     39class CreateMultipolygonActionTest {
    4040
    4141    /**
    4242     * Setup test.
    4343     */
    44     @Rule
     44    @RegisterExtension
    4545    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4646    public JOSMTestRules test = new JOSMTestRules().projection().main().preferences();
     
    8080
    8181    @Test
    82     public void testCreate1() throws Exception {
     82    void testCreate1() throws Exception {
    8383        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null);
    8484        Pair<SequenceCommand, Relation> mp = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), null);
     
    8888
    8989    @Test
    90     public void testCreate2() throws Exception {
     90    void testCreate2() throws Exception {
    9191        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null);
    9292        Relation mp = createMultipolygon(ds.getWays(), "ref=1 OR ref:1.1.", null, true);
     
    9595
    9696    @Test
    97     public void testUpdate1() throws Exception {
     97    void testUpdate1() throws Exception {
    9898        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null);
    9999        Relation mp = createMultipolygon(ds.getWays(), "ref=\".*1$\"", null, true);
     
    106106
    107107    @Test
    108     public void testUpdate2() throws Exception {
     108    void testUpdate2() throws Exception {
    109109        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null);
    110110        Relation mp = createMultipolygon(ds.getWays(), "ref=1 OR ref:1.1.1", null, true);
     
    119119     */
    120120    @Test
    121     public void testTicket17767() throws Exception {
     121    void testTicket17767() throws Exception {
    122122        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(17767, "upd-mp.osm"), null);
    123123        Layer layer = new OsmDataLayer(ds, null, null);
     
    141141     */
    142142    @Test
    143     public void testTicket17768() throws Exception {
     143    void testTicket17768() throws Exception {
    144144        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(17768, "dupmem.osm"), null);
    145145        Layer layer = new OsmDataLayer(ds, null, null);
  • trunk/test/unit/org/openstreetmap/josm/actions/DeleteLayerActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertNotNull;
    5 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertNull;
    66
    7 import org.junit.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.data.osm.DataSet;
    1010import org.openstreetmap.josm.gui.MainApplication;
     
    1717 * Unit tests for class {@link DeleteLayerAction}.
    1818 */
    19 public final class DeleteLayerActionTest {
     19final class DeleteLayerActionTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules();
     
    3030     */
    3131    @Test
    32     public void testActionPerformed() {
     32    void testActionPerformed() {
    3333        DeleteLayerAction action = new DeleteLayerAction();
    3434        // No layer
  • trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.junit.contrib.java.lang.system.ExpectedSystemExit;
    99import org.openstreetmap.josm.TestUtils;
     
    2222 * Unit tests for class {@link ExitAction}.
    2323 */
    24 public final class ExitActionTest {
     24final class ExitActionTest {
    2525
    2626    /**
    2727     * Setup test.
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules().main();
     
    3434     * System.exit rule
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    public final ExpectedSystemExit exit = ExpectedSystemExit.none();
    3838
     
    4141     */
    4242    @Test
    43     public void testActionPerformed() {
     43    void testActionPerformed() {
    4444        TestUtils.assumeWorkingJMockit();
    4545        exit.expectSystemExitWithStatus(0);
  • trunk/test/unit/org/openstreetmap/josm/actions/ExpertToggleActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.util.concurrent.atomic.AtomicBoolean;
     
    99import javax.swing.JPanel;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener;
    1414import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2121 * @since 11224
    2222 */
    23 public class ExpertToggleActionTest {
     23class ExpertToggleActionTest {
    2424    /**
    2525     * We need prefs to store expert mode state.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3434     */
    3535    @Test
    36     public void testVisibilitySwitcher() {
     36    void testVisibilitySwitcher() {
    3737        ExpertToggleAction.getInstance().setExpert(false);
    3838        JPanel c = new JPanel();
     
    5858     */
    5959    @Test
    60     public void testExpertModeListener() {
     60    void testExpertModeListener() {
    6161        AtomicBoolean value = new AtomicBoolean(false);
    6262        ExpertToggleAction.getInstance().setExpert(true);
  • trunk/test/unit/org/openstreetmap/josm/actions/ExtensionFileFilterTest.java

    r13352 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
    77import org.openstreetmap.josm.TestUtils;
    88import org.openstreetmap.josm.actions.ExtensionFileFilter.AddArchiveExtension;
     
    1313 * Unit tests for class {@link ExtensionFileFilter}.
    1414 */
    15 public class ExtensionFileFilterTest {
     15class ExtensionFileFilterTest {
    1616
    1717    private static void test(String extensions, String defaultExtension, String description, boolean addArchiveExtensionsToDescription,
     
    2828     */
    2929    @Test
    30     public void testNewFilterWithArchiveExtensions() {
     30    void testNewFilterWithArchiveExtensions() {
    3131        test("ext1", "ext1", "description", true,
    3232                "ext1,ext1.gz,ext1.bz,ext1.bz2,ext1.xz,ext1.zip",
     
    4747     */
    4848    @Test
    49     public void testEqualsContract() {
     49    void testEqualsContract() {
    5050        TestUtils.assumeWorkingEqualsVerifier();
    5151        EqualsVerifier.forClass(ExtensionFileFilter.class).usingGetClass()
     
    5757     */
    5858    @Test
    59     public void testEnumAddArchiveExtension() {
     59    void testEnumAddArchiveExtension() {
    6060        TestUtils.superficialEnumCodeCoverage(AddArchiveExtension.class);
    6161    }
  • trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.testutils.JOSMTestRules;
    77
     
    1111 * Test {@link FullscreenToggleAction}
    1212 */
    13 public class FullscreenToggleActionTest {
     13class FullscreenToggleActionTest {
    1414    /**
    1515     * Setup test.
    1616     */
    17     @Rule
     17    @RegisterExtension
    1818    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    1919    public JOSMTestRules test = new JOSMTestRules().main();
     
    2323     */
    2424    @Test
    25     public void testFullscreenToggleAction() {
     25    void testFullscreenToggleAction() {
    2626        FullscreenToggleAction action = new FullscreenToggleAction();
    2727        // Cannot really test it in headless mode, but at least check we can toggle the action without error
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r16438 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.io.IOException;
     
    1515import java.util.Set;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.TestUtils;
    2020import org.openstreetmap.josm.actions.search.SearchAction;
     
    4444 * Unit tests of {@link JoinAreasAction} class.
    4545 */
    46 public class JoinAreasActionTest {
     46class JoinAreasActionTest {
    4747
    4848    /**
    4949     * Setup test.
    5050     */
    51     @Rule
     51    @RegisterExtension
    5252    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5353    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
     
    5959     */
    6060    @Test
    61     public void testTicket9599() throws IOException, IllegalDataException {
     61    void testTicket9599() throws IOException, IllegalDataException {
    6262        try (InputStream is = TestUtils.getRegressionDataStream(9599, "ex5.osm")) {
    6363            DataSet ds = OsmReader.parseDataSet(is, null);
     
    8282     */
    8383    @Test
    84     public void testTicket9599Simple() throws IOException, IllegalDataException {
     84    void testTicket9599Simple() throws IOException, IllegalDataException {
    8585        try (InputStream is = TestUtils.getRegressionDataStream(9599, "three_old.osm")) {
    8686            DataSet ds = OsmReader.parseDataSet(is, null);
     
    106106     */
    107107    @Test
    108     public void testTicket10511() throws IOException, IllegalDataException {
     108    void testTicket10511() throws IOException, IllegalDataException {
    109109        try (InputStream is = TestUtils.getRegressionDataStream(10511, "10511_mini.osm")) {
    110110            DataSet ds = OsmReader.parseDataSet(is, null);
     
    128128     */
    129129    @Test
    130     public void testTicket11992() throws IOException, IllegalDataException {
     130    void testTicket11992() throws IOException, IllegalDataException {
    131131        try (InputStream is = TestUtils.getRegressionDataStream(11992, "shapes.osm")) {
    132132            DataSet ds = OsmReader.parseDataSet(is, null);
     
    154154     */
    155155    @Test
    156     public void testTicket18744() throws IOException, IllegalDataException {
     156    void testTicket18744() throws IOException, IllegalDataException {
    157157        try (InputStream is = TestUtils.getRegressionDataStream(18744, "18744-sample.osm")) {
    158158            DataSet ds = OsmReader.parseDataSet(is, null);
     
    179179    @Test
    180180    @SuppressWarnings({ "rawtypes", "unchecked" })
    181     public void testExamples() throws Exception {
     181    void testExamples() throws Exception {
    182182        DataSet dsToJoin, dsExpected;
    183183        try (InputStream is = Files.newInputStream(Paths.get("nodist/data/Join_Areas_Tests.osm"))) {
     
    199199            Collection<OsmPrimitive> primitives = tests.get(test);
    200200            for (OsmPrimitive osm : primitives) {
    201                 assertTrue(test + "; expected way, but got: " + osm, osm instanceof Way);
     201                assertTrue(osm instanceof Way, test + "; expected way, but got: " + osm);
    202202            }
    203203            new JoinAreasAction(false).join((Collection) primitives);
    204204            Collection<OsmPrimitive> joinedCol = dsToJoin.getPrimitives(osm -> !osm.isDeleted() && Objects.equals(osm.get("test"), test));
    205             assertEquals("in test " + test + ":", 1, joinedCol.size());
     205            assertEquals(1, joinedCol.size(), "in test " + test + ":");
    206206            Collection<OsmPrimitive> expectedCol = dsExpected.getPrimitives(osm -> !osm.isDeleted() && Objects.equals(osm.get("test"), test));
    207             assertEquals("in test " + test + ":", 1, expectedCol.size());
     207            assertEquals(1, expectedCol.size(), "in test " + test + ":");
    208208            OsmPrimitive osmJoined = joinedCol.iterator().next();
    209209            OsmPrimitive osmExpected = expectedCol.iterator().next();
    210             assertTrue("difference in test " + test, isSemanticallyEqual(osmExpected, osmJoined));
     210            assertTrue(isSemanticallyEqual(osmExpected, osmJoined), "difference in test " + test);
    211211        }
    212212    }
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java

    r16202 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    57
    68import java.awt.Rectangle;
     
    1012import java.util.stream.Collectors;
    1113
    12 import org.junit.Rule;
    13 import org.junit.Test;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1416import org.openstreetmap.josm.TestUtils;
    1517import org.openstreetmap.josm.data.coor.EastNorth;
     
    3335 * Unit tests for class {@link JoinNodeWayAction}.
    3436 */
    35 public final class JoinNodeWayActionTest {
     37final class JoinNodeWayActionTest {
    3638    /**
    3739     * Setup test.
    3840     */
    39     @Rule
     41    @RegisterExtension
    4042    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4143    public JOSMTestRules test = new JOSMTestRules().projection().main().preferences();
     
    6163     */
    6264    @Test
    63     public void testTicket18189() throws Exception {
     65    void testTicket18189() throws Exception {
    6466        DataSet dataSet = new DataSet();
    6567        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    9395            action.actionPerformed(null);
    9496            // Make sure the node was only moved once
    95             assertTrue("Node n5 wasn't added to way w1.", w1.containsNode(n5));
    96             assertTrue("Node n5 wasn't added to way w2.", w2.containsNode(n5));
    97             assertTrue("Node was moved to an unexpected position", n5.getEastNorth().equalsEpsilon(expected, 1e-7));
     97            assertTrue(w1.containsNode(n5), "Node n5 wasn't added to way w1.");
     98            assertTrue(w2.containsNode(n5), "Node n5 wasn't added to way w2.");
     99            assertTrue(n5.getEastNorth().equalsEpsilon(expected, 1e-7), "Node was moved to an unexpected position");
    98100        } finally {
    99101            MainApplication.getLayerManager().removeLayer(layer);
     
    106108     */
    107109    @Test
    108     public void testTicket11508() throws Exception {
     110    void testTicket11508() throws Exception {
    109111        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(11508, "11508_example.osm"), null);
    110112        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    113115            List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N"))
    114116                    .collect(Collectors.toList());
    115             assertTrue(nodesToMove.size() == 1);
     117            assertEquals(1, nodesToMove.size());
    116118            Node toMove = nodesToMove.iterator().next();
    117119            Node expected = new Node(new LatLon(47.56331849690742, 8.800789259499311));
     
    122124            action.actionPerformed(null);
    123125
    124             assertTrue("Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7));
    125             assertTrue("Node was not added to expected number of ways", toMove.getParentWays().size() == 2);
     126            assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     127            assertEquals(2, toMove.getParentWays().size(), "Node was not added to expected number of ways");
    126128        } finally {
    127129            MainApplication.getLayerManager().removeLayer(layer);
     
    134136     */
    135137    @Test
    136     public void testTicket18189Crossing() throws Exception {
     138    void testTicket18189Crossing() throws Exception {
    137139        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18189, "moveontocrossing.osm"), null);
    138140        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    144146            List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N"))
    145147                    .collect(Collectors.toList());
    146             assertTrue(nodesToMove.size() == 1);
     148            assertEquals(1, nodesToMove.size());
    147149            Node toMove = nodesToMove.iterator().next();
    148150            ds.setSelected(toMove);
     
    159161     */
    160162    @Test
    161     public void testTicket18189ThreeWays() throws Exception {
     163    void testTicket18189ThreeWays() throws Exception {
    162164        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18189, "data.osm"), null);
    163165        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    169171            List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N"))
    170172                    .collect(Collectors.toList());
    171             assertTrue(nodesToMove.size() == 1);
     173            assertEquals(1, nodesToMove.size());
    172174            Node toMove = nodesToMove.iterator().next();
    173175            Node expected = new Node(new LatLon(-21.088998104148224, -50.38629102179512));
    174176            ds.setSelected(toMove);
    175177            action.actionPerformed(null);
    176             assertTrue("Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7));
    177             assertTrue("Node was not added to expected number of ways", toMove.getParentWays().size() == 4);
    178 
     178            assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     179            assertEquals(4, toMove.getParentWays().size(), "Node was not added to expected number of ways");
    179180        } finally {
    180181            MainApplication.getLayerManager().removeLayer(layer);
     
    187188     */
    188189    @Test
    189     public void testTicket18420() throws Exception {
     190    void testTicket18420() throws Exception {
    190191        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18420, "user-sample.osm"), null);
    191192        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    193194        try {
    194195            List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name")).collect(Collectors.toList());
    195             assertTrue(nodesToMove.size() == 2);
     196            assertEquals(2, nodesToMove.size());
    196197            Node n = nodesToMove.iterator().next();
    197198            if (!n.hasTag("name", "select me 1st"))
     
    206207            action.setEnabled(true);
    207208            action.actionPerformed(null);
    208             assertTrue("Node was moved to an unexpected position", toMove1.getEastNorth().equalsEpsilon(expected1.getEastNorth(), 1e-7));
    209             assertTrue("Node was moved to an unexpected position", toMove2.getEastNorth().equalsEpsilon(expected2.getEastNorth(), 1e-7));
    210             assertTrue("Node was not added to expected number of ways", toMove1.getParentWays().size() == 2);
    211             assertTrue("Node was not added to expected number of ways", toMove2.getParentWays().size() == 2);
     209            assertTrue(toMove1.getEastNorth().equalsEpsilon(expected1.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     210            assertTrue(toMove2.getEastNorth().equalsEpsilon(expected2.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     211            assertEquals(2, toMove1.getParentWays().size(), "Node was not added to expected number of ways");
     212            assertEquals(2, toMove2.getParentWays().size(), "Node was not added to expected number of ways");
    212213        } finally {
    213214            MainApplication.getLayerManager().removeLayer(layer);
     
    220221     */
    221222    @Test
    222     public void testTicket18990() throws Exception {
     223    void testTicket18990() throws Exception {
    223224        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18990, "18990-sample.osm"), null);
    224225        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    226227        try {
    227228            Node toMove = (Node) ds.getPrimitiveById(new SimplePrimitiveId(7018586511L, OsmPrimitiveType.NODE));
    228             assertTrue(toMove != null);
     229            assertNotNull(toMove);
    229230            Node expected = new Node(new LatLon(43.48582074476985, -96.76897750613033));
    230231
     
    234235            action.setEnabled(true);
    235236            action.actionPerformed(null);
    236             assertTrue("Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7));
    237             assertTrue("Node was not added to expected way", toMove.getParentWays().size() == 1);
    238             assertTrue("Node was not added to expected way segment",
    239                     toMove.getParentWays().iterator().next().getNodes().indexOf(toMove) == 2);
     237            assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     238            assertEquals(1, toMove.getParentWays().size(), "Node was not added to expected way");
     239            assertEquals(2, toMove.getParentWays().iterator().next().getNodes().indexOf(toMove), "Node was not added to expected way segment");
    240240        } finally {
    241241            MainApplication.getLayerManager().removeLayer(layer);
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java

    r16159 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNull;
    66
    77import java.util.Collections;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.Before;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.TestUtils;
    1616import org.openstreetmap.josm.data.osm.DataSet;
     
    3434     * Setup test.
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    5858     * Setup test.
    5959     */
    60     @Before
     60    @BeforeEach
    6161    public void setUp() {
    6262        if (action == null) {
     
    7272     */
    7373    @Test
    74     public void testMergeNoSourceLayer() {
     74    void testMergeNoSourceLayer() {
    7575        assertNull(MainApplication.getLayerManager().getActiveLayer());
    7676        action.actionPerformed(null);
     
    8282     */
    8383    @Test
    84     public void testMergeNoTargetLayer() {
     84    void testMergeNoTargetLayer() {
    8585        TestUtils.assumeWorkingJMockit();
    8686        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
     
    105105     */
    106106    @Test
    107     public void testMergeTwoEmptyLayers() throws Exception {
     107    void testMergeTwoEmptyLayers() throws Exception {
    108108        TestUtils.assumeWorkingJMockit();
    109109        final MergeLayerExtendedDialogMocker edMocker = new MergeLayerExtendedDialogMocker();
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNull;
     6import static org.junit.jupiter.api.Assertions.assertThrows;
    67
    78import java.util.Arrays;
    89import java.util.Collections;
    910
    10 import org.junit.Rule;
    11 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1213import org.openstreetmap.josm.data.coor.LatLon;
    1314import org.openstreetmap.josm.data.osm.DataSet;
     
    2122 * Unit tests for class {@link MergeNodesAction}.
    2223 */
    23 public class MergeNodesActionTest {
     24class MergeNodesActionTest {
    2425
    2526    /**
    2627     * Setup test.
    2728     */
    28     @Rule
     29    @RegisterExtension
    2930    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3031    public JOSMTestRules test = new JOSMTestRules().projection();
     
    3334     * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - empty list
    3435     */
    35     @Test(expected = IllegalArgumentException.class)
    36     public void testSelectTargetLocationNodeEmpty() {
    37         MergeNodesAction.selectTargetLocationNode(Collections.emptyList());
     36    @Test
     37    void testSelectTargetLocationNodeEmpty() {
     38        assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(Collections.emptyList()));
    3839    }
    3940
     
    4142     * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - invalid mode
    4243     */
    43     @Test(expected = IllegalStateException.class)
    44     public void testSelectTargetLocationNodeInvalidMode() {
     44    @Test
     45    void testSelectTargetLocationNodeInvalidMode() {
    4546        Config.getPref().putInt("merge-nodes.mode", -1);
    46         MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1)));
     47        assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))));
    4748    }
    4849
     
    5152     */
    5253    @Test
    53     public void testSelectTargetLocationNode() {
     54    void testSelectTargetLocationNode() {
    5455        Config.getPref().putInt("merge-nodes.mode", 0);
    5556        assertEquals(1, MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))).getId());
     
    6869     */
    6970    @Test
    70     public void testSelectTargetNode() {
     71    void testSelectTargetNode() {
    7172        assertNull(MergeNodesAction.selectTargetNode(Collections.emptyList()));
    7273        DataSet ds = new DataSet();
  • trunk/test/unit/org/openstreetmap/josm/actions/MoveActionTest.java

    r11978 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import org.junit.Test;
     4import org.junit.jupiter.api.Test;
    55import org.openstreetmap.josm.TestUtils;
    66import org.openstreetmap.josm.actions.MoveAction.Direction;
     
    99 * Unit tests for class {@link ExtensionFileFilter}.
    1010 */
    11 public class MoveActionTest {
     11class MoveActionTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testEnumDirection() {
     17    void testEnumDirection() {
    1818        TestUtils.superficialEnumCodeCoverage(Direction.class);
    1919    }
  • trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    67import java.io.InputStream;
     
    1011import java.util.List;
    1112
    12 import org.junit.Rule;
    13 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1415import org.openstreetmap.josm.TestUtils;
    1516import org.openstreetmap.josm.actions.OrthogonalizeAction.Direction;
     
    3233 * Unit tests for class {@link OrthogonalizeAction}.
    3334 */
    34 public class OrthogonalizeActionTest {
     35class OrthogonalizeActionTest {
    3536
    3637    /**
    3738     * Setup test.
    3839     */
    39     @Rule
     40    @RegisterExtension
    4041    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4142    public JOSMTestRules test = new JOSMTestRules().projection();
    4243
    43     @Test(expected = OrthogonalizeAction.InvalidUserInputException.class)
    44     public void testNoSelection() throws Exception {
    45         performTest("nothing selected");
     44    @Test
     45    void testNoSelection() throws Exception {
     46        assertThrows(OrthogonalizeAction.InvalidUserInputException.class, () -> performTest("nothing selected"));
    4647    }
    4748
    4849    @Test
    49     public void testClosedWay() throws Exception {
     50    void testClosedWay() throws Exception {
    5051        final DataSet ds = performTest("name=ClosedWay");
    5152        final Way way = ds.getSelectedWays().iterator().next();
     
    5859
    5960    @Test
    60     public void testTwoWaysFormingClosedWay() throws Exception {
     61    void testTwoWaysFormingClosedWay() throws Exception {
    6162        performTest("name=TwoWaysFormingClosedWay");
    6263    }
    6364
    6465    @Test
    65     public void testTwoRingsAtOnce() throws Exception {
     66    void testTwoRingsAtOnce() throws Exception {
    6667        performTest("name=ClosedWay OR name=TwoWaysFormingClosedWay");
    6768    }
    6869
    6970    @Test
    70     public void testClosedWayWithReferenceNodes() throws Exception {
     71    void testClosedWayWithReferenceNodes() throws Exception {
    7172        final DataSet ds = performTest("name=ClosedWayWithReferenceNodes");
    7273        final Way way = ds.getSelectedWays().iterator().next();
     
    7980
    8081    @Test
    81     public void testFourNodes() throws Exception {
     82    void testFourNodes() throws Exception {
    8283        final DataSet ds = performTest(
    8384                "name=NodeToRectify-01", "name=NodeToRectify-02", "name=NodeToRectify-03", "name=NodeToRectify-04");
     
    9495     */
    9596    @Test
    96     public void testUtilityClass() throws ReflectiveOperationException {
     97    void testUtilityClass() throws ReflectiveOperationException {
    9798        UtilityClassTestUtil.assertUtilityClassWellDefined(OrthogonalizeAction.EN.class);
    9899    }
     
    122123     */
    123124    @Test
    124     public void testEnumDirection() {
     125    void testEnumDirection() {
    125126        TestUtils.superficialEnumCodeCoverage(Direction.class);
    126127    }
  • trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.io.FileNotFoundException;
     
    99import java.io.InputStream;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.data.osm.DataSet;
     
    2525 * Unit tests for class {@link PurgeAction}.
    2626 */
    27 public class PurgeActionTest {
     27class PurgeActionTest {
    2828
    2929    /**
    3030     * Setup test.
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules().main();
     
    4141     */
    4242    @Test
    43     public void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException {
     43    void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException {
    4444        try (InputStream is = TestUtils.getRegressionDataStream(12038, "data.osm")) {
    4545            DataSet ds = OsmReader.parseDataSet(is, null);
  • trunk/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java

    r13938 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.data.osm.DataSet;
    99import org.openstreetmap.josm.gui.MainApplication;
     
    1515 * Unit tests for class {@link SelectAllAction}.
    1616 */
    17 public final class SelectAllActionTest {
     17final class SelectAllActionTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main();
     
    2828     */
    2929    @Test
    30     public void testActionPerformed() {
     30    void testActionPerformed() {
    3131        SelectByInternalPointActionTest.initDataSet();
    3232        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
  • trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertNull;
    7 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.data.coor.EastNorth;
    1212import org.openstreetmap.josm.data.osm.DataSet;
     
    2626 * Unit tests for class {@link SelectByInternalPointAction}.
    2727 */
    28 public final class SelectByInternalPointActionTest {
     28final class SelectByInternalPointActionTest {
    2929
    3030    /**
    3131     * Setup test.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main();
     
    4040     */
    4141    @Test
    42     public void testUtilityClass() throws ReflectiveOperationException {
     42    void testUtilityClass() throws ReflectiveOperationException {
    4343        UtilityClassTestUtil.assertUtilityClassWellDefined(SelectByInternalPointAction.class);
    4444    }
     
    4848     */
    4949    @Test
    50     public void testNoDataSet() {
     50    void testNoDataSet() {
    5151        assertNull(MainApplication.getLayerManager().getEditDataSet());
    5252        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size());
     
    8585     */
    8686    @Test
    87     public void testGetSurroundingObjects() {
     87    void testGetSurroundingObjects() {
    8888        initDataSet();
    8989        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size());
     
    9797     */
    9898    @Test
    99     public void testGetSmallestSurroundingObject() {
     99    void testGetSmallestSurroundingObject() {
    100100        initDataSet();
    101101        assertNull(SelectByInternalPointAction.getSmallestSurroundingObject(null));
     
    107107     */
    108108    @Test
    109     public void testPerformSelection() {
     109    void testPerformSelection() {
    110110        initDataSet();
    111111        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
  • trunk/test/unit/org/openstreetmap/josm/actions/SessionLoadActionTest.java

    r15070 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.data.imagery.ImageryInfo;
    99import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     
    1616 * Unit tests for class {@link SessionLoadAction}.
    1717 */
    18 public class SessionLoadActionTest {
     18class SessionLoadActionTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    2929     */
    3030    @Test
    31     public void testTicket17702() {
     31    void testTicket17702() {
    3232        assertFalse(SessionLoadAction.Loader.addLayer(new TMSLayer(new ImageryInfo(
    3333                "Bing Карта (GLOBALCITY)",
  • trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests for class {@link SessionSaveAsAction}.
    1414 */
    15 public class SessionSaveAsActionTest {
     15class SessionSaveAsActionTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testSessionSaveAsAction() {
     28    void testSessionSaveAsAction() {
    2929        SessionSaveAsAction action = new SessionSaveAsAction();
    3030        assertFalse(action.isEnabled());
  • trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java

    r15432 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
    66
    77import java.io.IOException;
     
    1616import java.util.stream.Stream;
    1717
    18 import org.junit.Before;
    19 import org.junit.Rule;
    20 import org.junit.Test;
     18import org.junit.jupiter.api.BeforeEach;
     19import org.junit.jupiter.api.Test;
     20import org.junit.jupiter.api.extension.RegisterExtension;
    2121import org.openstreetmap.josm.TestUtils;
    2222import org.openstreetmap.josm.command.DeleteCommand;
     
    3737 * Unit tests for class {@link SimplifyWayAction}.
    3838 */
    39 public final class SimplifyWayActionTest {
     39final class SimplifyWayActionTest {
    4040
    4141    /** Class under test. */
     
    4545     * Setup test.
    4646     */
    47     @Rule
     47    @RegisterExtension
    4848    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4949    public JOSMTestRules test = new JOSMTestRules().main();
     
    5252     * Setup test.
    5353     */
    54     @Before
     54    @BeforeEach
    5555    public void setUp() {
    5656        if (action == null) {
     
    6969     */
    7070    @Test
    71     public void testSimplify() throws Exception {
     71    void testSimplify() throws Exception {
    7272        DataSet DsSimplify = getDs("tracks");
    7373        DataSet DsExpected = getDs("tracks-simplify15");
     
    9191     */
    9292    @Test
    93     public void testSimplifyFirstNode() {
     93    void testSimplifyFirstNode() {
    9494        final DataSet ds = new DataSet();
    9595        final Node n1 = new Node(new LatLon(47.26269614984, 11.34044231149));
  • trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java

    r15728 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertSame;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertSame;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.util.Arrays;
    88
    9 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    109import org.junit.Assert;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1312import org.openstreetmap.josm.TestUtils;
    1413import org.openstreetmap.josm.data.coor.EastNorth;
     
    2120import org.openstreetmap.josm.testutils.JOSMTestRules;
    2221
     22import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     23
    2324/**
    2425 * Unit tests for class {@link SplitWayAction}.
    2526 */
    26 public final class SplitWayActionTest {
     27final class SplitWayActionTest {
    2728
    2829    /**
    2930     * Setup test.
    3031     */
    31     @Rule
     32    @RegisterExtension
    3233    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3334    public JOSMTestRules test = new JOSMTestRules().projection();
     
    4546     */
    4647    @Test
    47     public void testTicket11184() {
     48    void testTicket11184() {
    4849        Node n1 = addNode(0, 0);
    4950        Node n2 = addNode(-1, 1);
     
    6869
    6970        // Ensures 3 ways.
    70         assertSame(String.format("Found %d ways after split action instead of 3.", dataSet.getWays().size()),
    71                    dataSet.getWays().size(), 3);
     71        assertSame(3, dataSet.getWays().size(), String.format("Found %d ways after split action instead of 3.", dataSet.getWays().size()));
    7272
    7373        // Ensures way w1 is unchanged.
    74         assertTrue("Unselected ways disappear during split action.",
    75                    dataSet.getWays().contains(w1));
    76         assertSame("Unselected way seems to have change during split action.",
    77                    w1.getNodesCount(), 3);
     74        assertTrue(dataSet.getWays().contains(w1), "Unselected ways disappear during split action.");
     75        assertSame(3, w1.getNodesCount(), "Unselected way seems to have change during split action.");
    7876        for (int i = 0; i < 3; i++) {
    79             assertSame("Node change in unselected way during split action.",
    80                        w1.getNode(i), w1NodesArray[i]);
     77            assertSame(w1.getNode(i), w1NodesArray[i], "Node change in unselected way during split action.");
    8178        }
    8279    }
     
    8885     */
    8986    @Test
    90     public void testTicket17810() {
     87    void testTicket17810() {
    9188        DataSet dataSet = new DataSet();
    9289        Way from = TestUtils.newWay("highway=residential", new Node(new LatLon(0.0, 0.0)),
     
    122119     */
    123120    @Test
    124     public void testTicket18477() {
     121    void testTicket18477() {
    125122        final Node n10 = addNode(1, 0);
    126123        final Node n21 = addNode(2, 1);
     
    133130        dataSet.setSelected(n10, n21);
    134131        SplitWayAction.runOn(dataSet);
    135         assertSame(String.format("Found %d ways after split action instead of 4.", dataSet.getWays().size()),
    136                 dataSet.getWays().size(), 4);
     132        assertSame(4, dataSet.getWays().size(), String.format("Found %d ways after split action instead of 4.", dataSet.getWays().size()));
    137133    }
    138134}
  • trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java

    r16300 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.Before;
    8 import org.junit.Rule;
    9 import org.junit.Test;
     7import org.junit.jupiter.api.BeforeEach;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
    1010import org.openstreetmap.josm.data.coor.LatLon;
    1111import org.openstreetmap.josm.data.osm.DataSet;
     
    2121 * Unit tests for class {@link UnGlueAction}.
    2222 */
    23 public final class UnGlueActionTest {
     23final class UnGlueActionTest {
    2424
    2525    /** Class under test. */
     
    2929     * Setup test.
    3030     */
    31     @Rule
     31    @RegisterExtension
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3333    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
     
    3636     * Setup test.
    3737     */
    38     @Before
     38    @BeforeEach
    3939    public void setUp() {
    4040        if (action == null) {
     
    4848     */
    4949    @Test
    50     public void testSelectionEmpty() {
     50    void testSelectionEmpty() {
    5151        DataSet ds = new DataSet();
    5252        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
     
    6666     */
    6767    @Test
    68     public void testSingleNodeNotInWay() {
     68    void testSingleNodeNotInWay() {
    6969        DataSet ds = new DataSet();
    7070        Node n = new Node(LatLon.ZERO);
     
    8787     */
    8888    @Test
    89     public void testSingleNodeInSingleWay() {
     89    void testSingleNodeInSingleWay() {
    9090        DataSet ds = new DataSet();
    9191        Node n1 = new Node(LatLon.ZERO);
     
    114114     */
    115115    @Test
    116     public void testSingleNodeInTwoWays() {
     116    void testSingleNodeInTwoWays() {
    117117        DataSet ds = new DataSet();
    118118        Node n1 = new Node(LatLon.ZERO);
  • trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
    55
    66import java.util.Arrays;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
    1010import org.openstreetmap.josm.data.coor.EastNorth;
    1111import org.openstreetmap.josm.data.osm.DataSet;
     
    2121 * Unit tests for class {@link UnJoinNodeWayAction}.
    2222 */
    23 public final class UnJoinNodeWayActionTest {
     23final class UnJoinNodeWayActionTest {
    2424
    2525    /**
     
    4040     * Setup test.
    4141     */
    42     @Rule
     42    @RegisterExtension
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4444    public JOSMTestRules test = new JOSMTestRules();
     
    5151     */
    5252    @Test
    53     public void testTicket10396() {
     53    void testTicket10396() {
    5454        DataSet dataSet = new DataSet();
    5555        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    8383
    8484        // Ensures node n2 remove from w
    85         assertFalse("Node n2 wasn't removed from way w.", w.containsNode(n2));
     85        assertFalse(w.containsNode(n2), "Node n2 wasn't removed from way w.");
    8686    }
    8787}
  • trunk/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayNoTagCorrectorTest.java

    r17023 r17275  
    22package org.openstreetmap.josm.actions.corrector;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.data.osm.Tag;
    99import org.openstreetmap.josm.data.osm.Tagged;
     
    1616 * Unit tests of {@link ReverseWayNoTagCorrector} class.
    1717 */
    18 public class ReverseWayNoTagCorrectorTest {
     18class ReverseWayNoTagCorrectorTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules();
     
    2929     */
    3030    @Test
    31     public void testDirectionalTags() {
     31    void testDirectionalTags() {
    3232        assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("waterway", "drain")).size());
    3333        assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("man_made", "embankment")).size());
  • trunk/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrectorTest.java

    r16771 r17275  
    88
    99import org.junit.Assert;
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.data.correction.TagCorrection;
    1313import org.openstreetmap.josm.data.osm.Node;
     
    2424 * Unit tests of {@link ReverseWayTagCorrector} class.
    2525 */
    26 public class ReverseWayTagCorrectorTest {
     26class ReverseWayTagCorrectorTest {
    2727
    2828    /**
    2929     * Setup test.
    3030     */
    31     @Rule
     31    @RegisterExtension
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3333    public JOSMTestRules test = new JOSMTestRules();
     
    3838     */
    3939    @Test
    40     public void testUtilityClass() throws ReflectiveOperationException {
     40    void testUtilityClass() throws ReflectiveOperationException {
    4141        UtilityClassTestUtil.assertUtilityClassWellDefined(ReverseWayTagCorrector.TagSwitcher.class);
    4242    }
     
    4646     */
    4747    @Test
    48     public void testTagSwitch() {
     48    void testTagSwitch() {
    4949        // oneway
    5050        assertSwitch(new Tag("oneway", "yes"), new Tag("oneway", "-1"));
     
    121121     */
    122122    @Test
    123     public void testSwitchingWayNodes() {
     123    void testSwitchingWayNodes() {
    124124        final Map<OsmPrimitive, List<TagCorrection>> tagCorrections = getTagCorrectionsForWay("direction=forward");
    125125        Assert.assertEquals(1, tagCorrections.size());
     
    132132     */
    133133    @Test
    134     public void testNotSwitchingWayNodes() {
     134    void testNotSwitchingWayNodes() {
    135135        Assert.assertEquals(0, getTagCorrectionsForWay("direction=SSW").size());
    136136        Assert.assertEquals(0, getTagCorrectionsForWay("direction=145").size());
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTaskTest.java

    r10945 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    67import java.awt.Component;
    78import java.util.Arrays;
    89
    9 import org.junit.Rule;
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1112import org.openstreetmap.josm.testutils.JOSMTestRules;
    1213
     
    1617 * Unit tests for class {@link ChangesetContentDownloadTask}.
    1718 */
    18 public class ChangesetContentDownloadTaskTest {
     19class ChangesetContentDownloadTaskTest {
    1920
    2021    /**
    2122     * Setup test.
    2223     */
    23     @Rule
     24    @RegisterExtension
    2425    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2526    public JOSMTestRules test = new JOSMTestRules();
     
    2930     */
    3031    @Test
    31     public void testChangesetContentDownloadTask() {
     32    void testChangesetContentDownloadTask() {
    3233        Component parent = new Component() {
    3334            // empty component
     
    4142     * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - invalid changeset id.
    4243     */
    43     @Test(expected = IllegalArgumentException.class)
    44     public void testChangesetContentDownloadTaskInvalidId() {
    45         new ChangesetContentDownloadTask(0);
     44    @Test
     45    void testChangesetContentDownloadTaskInvalidId() {
     46        assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(0));
    4647    }
    4748
     
    4950     * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - null parent.
    5051     */
    51     @Test(expected = IllegalArgumentException.class)
    52     public void testChangesetContentDownloadTaskNullParent1() {
    53         new ChangesetContentDownloadTask(1);
     52    @Test
     53    void testChangesetContentDownloadTaskNullParent1() {
     54        assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(1));
    5455    }
    5556
     
    5758     * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - null parent.
    5859     */
    59     @Test(expected = IllegalArgumentException.class)
    60     public void testChangesetContentDownloadTaskNullParent2() {
    61         new ChangesetContentDownloadTask(Arrays.asList(1, 2));
     60    @Test
     61    void testChangesetContentDownloadTaskNullParent2() {
     62        assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(Arrays.asList(1, 2)));
    6263    }
    6364}
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTaskTest.java

    r15153 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    67import java.awt.Component;
    78import java.util.Collections;
    89
    9 import org.junit.Rule;
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1112import org.openstreetmap.josm.data.osm.Changeset;
    1213import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1718 * Unit tests for class {@link ChangesetHeaderDownloadTask}.
    1819 */
    19 public class ChangesetHeaderDownloadTaskTest {
     20class ChangesetHeaderDownloadTaskTest {
    2021
    2122    /**
    2223     * Setup test.
    2324     */
    24     @Rule
     25    @RegisterExtension
    2526    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2627    public JOSMTestRules test = new JOSMTestRules();
     
    3031     */
    3132    @Test
    32     public void testBuildTaskForChangesets() {
     33    void testBuildTaskForChangesets() {
    3334        Component parent = new Component() {
    3435            // empty component
     
    4243     * Unit test of {@code ChangesetHeaderDownloadTask#buildTaskForChangesets} - null parent.
    4344     */
    44     @Test(expected = NullPointerException.class)
    45     public void testBuildTaskForChangesetsNullParent() {
    46         ChangesetHeaderDownloadTask.buildTaskForChangesets(Collections.singleton(new Changeset(1)));
     45    @Test
     46    void testBuildTaskForChangesetsNullParent() {
     47        assertThrows(NullPointerException.class,
     48                () -> ChangesetHeaderDownloadTask.buildTaskForChangesets(Collections.singleton(new Changeset(1))));
    4749    }
    4850}
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTaskTest.java

    r10945 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    67import java.awt.Component;
    78
    8 import org.junit.Rule;
    9 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1011import org.openstreetmap.josm.io.ChangesetQuery;
    1112import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1617 * Unit tests for class {@link ChangesetQueryTask}.
    1718 */
    18 public class ChangesetQueryTaskTest {
     19class ChangesetQueryTaskTest {
    1920
    2021    /**
    2122     * Setup test.
    2223     */
    23     @Rule
     24    @RegisterExtension
    2425    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2526    public JOSMTestRules test = new JOSMTestRules();
     
    2930     */
    3031    @Test
    31     public void testChangesetQueryTask() {
     32    void testChangesetQueryTask() {
    3233        Component parent = new Component() {
    3334            // empty component
     
    3940     * Unit test of {@code ChangesetQueryTask#ChangesetQueryTask} - null parent.
    4041     */
    41     @Test(expected = IllegalArgumentException.class)
    42     public void testChangesetQueryTaskNullParent() {
    43         new ChangesetQueryTask(new ChangesetQuery());
     42    @Test
     43    void testChangesetQueryTaskNullParent() {
     44        assertThrows(IllegalArgumentException.class, () -> new ChangesetQueryTask(new ChangesetQuery()));
    4445    }
    4546}
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTaskTest.java

    r10945 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
    1010import org.openstreetmap.josm.data.coor.LatLon;
    1111import org.openstreetmap.josm.data.osm.DataSet;
     
    2020 * Unit tests for class {@link DownloadReferrersTask}.
    2121 */
    22 public class DownloadReferrersTaskTest {
     22class DownloadReferrersTaskTest {
    2323
    2424    /**
    2525     * Setup test.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules();
     
    3333     */
    3434    @Test
    35     public void testDownloadReferrersTask() {
     35    void testDownloadReferrersTask() {
    3636        DataSet ds = new DataSet();
    3737        Node n1 = (Node) OsmPrimitiveType.NODE.newInstance(-1, true);
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java

    r15216 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertNull;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
     5import static org.junit.jupiter.api.Assertions.assertNull;
    66
    77import java.awt.geom.Area;
    88import java.util.Collections;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1212import org.openstreetmap.josm.data.Bounds;
    1313import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    1919 * Unit tests for class {@link DownloadTaskList}.
    2020 */
    21 public class DownloadTaskListTest {
     21class DownloadTaskListTest {
    2222
    2323    /**
    2424     * Setup test.
    2525     */
    26     @Rule
     26    @Reg