Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (13 months 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/unit/org/openstreetmap/josm/plugins
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginDownloadExceptionTest.java

    r12754 r17275  
    22package org.openstreetmap.josm.plugins;
    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.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link PluginDownloadException} class.
    1414 */
    15 public class PluginDownloadExceptionTest {
     15class PluginDownloadExceptionTest {
    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 testPluginDownloadException() {
     28    void testPluginDownloadException() {
    2929        PluginDownloadException ex = new PluginDownloadException("foo");
    3030        assertEquals("foo", ex.getMessage());
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginExceptionTest.java

    r12754 r17275  
    22package org.openstreetmap.josm.plugins;
    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.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link PluginException} class.
    1414 */
    15 public class PluginExceptionTest {
     15class PluginExceptionTest {
    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 testPluginDownloadException() {
     28    void testPluginDownloadException() {
    2929        PluginException ex = new PluginException("foo");
    3030        assertEquals("foo", ex.getMessage());
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java

    r16159 r17275  
    22package org.openstreetmap.josm.plugins;
    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;
    88
    99import java.util.ArrayList;
     
    1717import javax.swing.JScrollPane;
    1818
    19 import org.junit.Rule;
    20 import org.junit.Test;
     19import org.junit.jupiter.api.extension.RegisterExtension;
     20import org.junit.jupiter.api.Test;
    2121import org.openstreetmap.josm.TestUtils;
    2222import org.openstreetmap.josm.gui.MainApplication;
     
    3535 * Unit tests of {@link PluginHandler} class.
    3636 */
    37 public class PluginHandlerTest {
     37class PluginHandlerTest {
    3838
    3939    /**
    4040     * Setup test.
    4141     */
    42     @Rule
     42    @RegisterExtension
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4444    public JOSMTestRules test = new JOSMTestRules();
     
    4848     */
    4949    @Test
    50     public void testEqualsContract() {
     50    void testEqualsContract() {
    5151        TestUtils.assumeWorkingEqualsVerifier();
    5252        EqualsVerifier.forClass(DeprecatedPlugin.class).usingGetClass().verify();
     
    5757     */
    5858    @Test
    59     public void testBuildListOfPluginsToLoad() {
     59    void testBuildListOfPluginsToLoad() {
    6060        TestUtils.assumeWorkingJMockit();
    6161        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
     
    100100     */
    101101    @Test
    102     public void testFilterDeprecatedPlugins() {
     102    void testFilterDeprecatedPlugins() {
    103103        TestUtils.assumeWorkingJMockit();
    104104        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
     
    125125     */
    126126    @Test
    127     public void testFilterUnmaintainedPlugins() {
     127    void testFilterUnmaintainedPlugins() {
    128128        TestUtils.assumeWorkingJMockit();
    129129        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
     
    152152     */
    153153    @Test
    154     public void testPluginInformationAction() throws PluginException {
     154    void testPluginInformationAction() throws PluginException {
    155155        TestUtils.assumeWorkingJMockit();
    156156        final String expectedText = "Ant-Version: Apache Ant 1.9.6\n" +
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java

    r17129 r17275  
    22package org.openstreetmap.josm.plugins;
    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.awt.GraphicsEnvironment;
     
    2121import java.util.stream.Collectors;
    2222
    23 import org.junit.BeforeClass;
    2423import org.junit.ClassRule;
    25 import org.junit.Test;
     24import org.junit.jupiter.api.BeforeAll;
     25import org.junit.jupiter.api.Test;
    2626import org.openstreetmap.josm.TestUtils;
    2727import org.openstreetmap.josm.data.Preferences;
     
    5959     * @throws IOException in case of I/O error
    6060     */
    61     @BeforeClass
     61    @BeforeAll
    6262    public static void beforeClass() throws IOException {
    6363        errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(PluginHandlerTestIT.class));
     
    6868     */
    6969    @Test
    70     public void testValidityOfAvailablePlugins() {
     70    void testValidityOfAvailablePlugins() {
    7171        loadAllPlugins();
    7272
     
    109109                Arrays.toString(layerExceptions.entrySet().toArray()) + '\n'
    110110                + Arrays.toString(noRestartExceptions.entrySet().toArray());
    111         assertTrue(msg, invalidManifestEntries.isEmpty() && loadingExceptions.isEmpty() && layerExceptions.isEmpty());
     111        assertTrue(invalidManifestEntries.isEmpty() && loadingExceptions.isEmpty() && layerExceptions.isEmpty(), msg);
    112112    }
    113113
     
    254254        // Restore default timeout
    255255        Config.getPref().putInt("socket.timeout.read", defTimeout);
    256         assertTrue(pluginDownloadTask.getFailedPlugins().toString(), pluginDownloadTask.getFailedPlugins().isEmpty());
     256        assertTrue(pluginDownloadTask.getFailedPlugins().isEmpty(), pluginDownloadTask.getFailedPlugins()::toString);
    257257        assertEquals(plugins.size(), pluginDownloadTask.getDownloadedPlugins().size());
    258258
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginListParseExceptionTest.java

    r12754 r17275  
    22package org.openstreetmap.josm.plugins;
    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.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link PluginListParseException} class.
    1414 */
    15 public class PluginListParseExceptionTest {
     15class PluginListParseExceptionTest {
    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 testPluginListParseException() {
     28    void testPluginListParseException() {
    2929        NullPointerException npe = new NullPointerException();
    3030        PluginListParseException ex = new PluginListParseException(npe);
Note: See TracChangeset for help on using the changeset viewer.