Ignore:
Timestamp:
2023-10-04T00:03:40+02:00 (13 months ago)
Author:
taylor.smock
Message:

See #16567: Update to JUnit 5

This removes new JOSMTestRules() with no additional setup and most
JOSMFixture calls.

Removing the bare JOSMTestRules speeds up the test suite since there are two
fewer System.gc() calls per test.

Location:
trunk/test/functional/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/gui/GettingStartedTest.java

    r17275 r18853  
    66import java.io.IOException;
    77
     8import org.junit.jupiter.api.Disabled;
    89import org.junit.jupiter.api.Test;
    9 import org.junit.jupiter.api.BeforeAll;
    10 import org.junit.jupiter.api.Disabled;
    11 import org.openstreetmap.josm.JOSMFixture;
    1210
    1311/**
     
    1513 */
    1614class GettingStartedTest {
    17 
    18     /**
    19      * Setup test.
    20      */
    21     @BeforeAll
    22     public static void init() {
    23         JOSMFixture.createFunctionalTestFixture().init();
    24     }
    25 
    2615    /**
    2716     * Tests that image links are replaced.
  • trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTestFT.java

    r17275 r18853  
    66import javax.swing.JFrame;
    77
    8 import org.junit.jupiter.api.BeforeAll;
    98import org.openstreetmap.josm.JOSMFixture;
    109import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    1817
    1918class HistoryBrowserTestFT extends JFrame {
    20 
    21     @BeforeAll
    22     public static void init() {
    23         JOSMFixture.createFunctionalTestFixture().init();
    24     }
    2519
    2620    private HistoryBrowser browser;
     
    5751
    5852    public static void main(String[] args) {
    59         HistoryBrowserTestFT.init();
     53        JOSMFixture.createFunctionalTestFixture().init();
    6054        new HistoryBrowserTestFT().setVisible(true);
    6155    }
  • trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java

    r17275 r18853  
    2525import javax.swing.ImageIcon;
    2626
    27 import org.junit.jupiter.api.BeforeAll;
    2827import org.junit.jupiter.api.BeforeEach;
    2928import org.junit.jupiter.api.Test;
    30 import org.junit.jupiter.api.extension.RegisterExtension;
    3129import org.junit.jupiter.params.ParameterizedTest;
    3230import org.junit.jupiter.params.provider.ValueSource;
    33 import org.openstreetmap.josm.JOSMFixture;
    3431import org.openstreetmap.josm.TestUtils;
    3532import org.openstreetmap.josm.data.coor.LatLon;
     
    3835import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
    3936import org.openstreetmap.josm.gui.tagging.presets.items.Key;
    40 import org.openstreetmap.josm.testutils.JOSMTestRules;
    4137import org.xml.sax.SAXException;
    4238
    4339import com.kitfox.svg.SVGConst;
    44 
    4540import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    4641
     
    4944 */
    5045class ImageProviderTest {
    51 
    52     /**
    53      * Setup test.
    54      */
    55     @RegisterExtension
    56     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    57     public JOSMTestRules test = new JOSMTestRules();
    58 
    5946    private static final class LogHandler14319 extends Handler {
    6047        boolean failed;
     
    7461        public void close() throws SecurityException {
    7562        }
    76     }
    77 
    78     /**
    79      * Setup test.
    80      */
    81     @BeforeAll
    82     public static void setUp() {
    83         JOSMFixture.createUnitTestFixture().init();
    8463    }
    8564
  • trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTestIT.java

    r17275 r18853  
    55
    66import org.junit.jupiter.api.Test;
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    8 import org.openstreetmap.josm.testutils.JOSMTestRules;
    9 
    10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    117
    128/**
     
    1410 */
    1511class ImageProviderTestIT {
    16 
    17     /**
    18      * Setup test.
    19      */
    20     @RegisterExtension
    21     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules();
    23 
    2412    /**
    2513     * Test fetching an image using {@code wiki://} protocol.
  • trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTestManual.java

    r17275 r18853  
    1111import javax.swing.JPanel;
    1212
     13import org.junit.jupiter.api.Disabled;
    1314import org.junit.jupiter.api.Test;
    14 import org.junit.jupiter.api.Disabled;
    15 import org.junit.jupiter.api.extension.RegisterExtension;
    16 import org.openstreetmap.josm.testutils.JOSMTestRules;
    17 
    18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1915
    2016/**
     
    2218 */
    2319class ImageProviderTestManual {
    24 
    25     /**
    26      * Setup test.
    27      */
    28     @RegisterExtension
    29     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules();
    31 
    3220    /**
    3321     * Test getting a cursor
    3422     * @throws InterruptedException in case of thread interruption
    3523     */
    36     @Disabled("manual execution only, as the look of the cursor cannot be checked automatedly")
     24    @Disabled("manual execution only, as the look of the cursor cannot be checked automatically")
    3725    @Test
    3826    void testGetCursor() throws InterruptedException {
Note: See TracChangeset for help on using the changeset viewer.