Changeset 17275 in josm for trunk/test/functional


Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (3 years 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/functional/org/openstreetmap/josm
Files:
20 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);
Note: See TracChangeset for help on using the changeset viewer.