Changeset 14153 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2018-08-13T02:18:54+02:00 (6 years ago)
Author:
Don-vip
Message:

see #15229 - deprecate Main.parent and Main itself

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModelTest.java

    r14092 r14153  
    659659    /* PropertyChangeListener                                                        */
    660660    /* ----------------------------------------------------------------------------- */
    661     @SuppressWarnings("unchecked")
    662661    @Test
    663662    public void testAddPropertyChangeListener() throws ReflectiveOperationException {
     
    675674    }
    676675
    677     @SuppressWarnings("unchecked")
    678676    @Test
    679677    public void testRemovePropertyChangeListener() throws ReflectiveOperationException {
     
    711709            public ArrayList<PropertyChangeEvent> events = new ArrayList<>();
    712710
     711            @Override
    713712            public void propertyChange(PropertyChangeEvent evt) {
    714713                events.add(evt);
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java

    r14149 r14153  
    99
    1010import java.awt.Component;
    11 import java.awt.Window;
    1211import java.io.File;
    1312import java.nio.file.Files;
     
    2120import org.junit.Rule;
    2221import org.junit.Test;
    23 import org.openstreetmap.josm.Main;
    2422import org.openstreetmap.josm.TestUtils;
    2523import org.openstreetmap.josm.data.Preferences;
     
    6967    @Before
    7068    public void setUp() throws ReflectiveOperationException {
    71         if (!java.awt.GraphicsEnvironment.isHeadless()) {
    72             originalMainParent = Main.parent;
    73             Main.parent = new Window(null);
    74         }
    7569
    7670        // some other tests actually go ahead and load plugins (notably at time of writing,
     
    120114        pluginList.clear();
    121115        pluginList.addAll(this.originalPluginList);
    122 
    123         if (!java.awt.GraphicsEnvironment.isHeadless()) {
    124             Main.parent = originalMainParent;
    125         }
    126116    }
    127117
    128118    private Collection<PluginProxy> originalPluginList;
    129 
    130     private Component originalMainParent;
    131119
    132120    private File pluginDir;
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java

    r14149 r14153  
    1515import org.junit.Rule;
    1616import org.junit.Test;
    17 import org.openstreetmap.josm.Main;
    1817import org.openstreetmap.josm.TestUtils;
    1918import org.openstreetmap.josm.data.Preferences;
     19import org.openstreetmap.josm.gui.MainApplication;
    2020import org.openstreetmap.josm.spi.preferences.Config;
    2121import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    115115
    116116        final List<PluginInformation> updatedPlugins = PluginHandler.updatePlugins(
    117             Main.parent,
     117            MainApplication.getMainFrame(),
    118118            null,
    119119            null,
     
    183183
    184184        final List<PluginInformation> updatedPlugins = PluginHandler.updatePlugins(
    185             Main.parent,
     185            MainApplication.getMainFrame(),
    186186            null,
    187187            null,
     
    257257
    258258        final List<PluginInformation> updatedPlugins = ImmutableList.copyOf(PluginHandler.updatePlugins(
    259             Main.parent,
     259            MainApplication.getMainFrame(),
    260260            null,
    261261            null,
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java

    r14138 r14153  
    1313import org.junit.Rule;
    1414import org.junit.Test;
    15 import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.TestUtils;
     16import org.openstreetmap.josm.gui.MainApplication;
    1717import org.openstreetmap.josm.gui.preferences.plugin.PluginPreferenceTest;
    1818import org.openstreetmap.josm.plugins.PluginHandler.DeprecatedPlugin;
     
    7373    public void testFilterDeprecatedPlugins() {
    7474        List<String> plugins = new ArrayList<>(Arrays.asList("foo", "bar", "imagery"));
    75         PluginHandler.filterDeprecatedPlugins(Main.parent, plugins);
     75        PluginHandler.filterDeprecatedPlugins(MainApplication.getMainFrame(), plugins);
    7676        assertEquals(2, plugins.size());
    7777        assertFalse(plugins.contains("imagery"));
     
    8484    public void testFilterUnmaintainedPlugins() {
    8585        List<String> plugins = new ArrayList<>(Arrays.asList("foo", "bar", "gpsbabelgui"));
    86         PluginHandler.filterUnmaintainedPlugins(Main.parent, plugins);
     86        PluginHandler.filterUnmaintainedPlugins(MainApplication.getMainFrame(), plugins);
    8787        assertEquals(2, plugins.size());
    8888        assertFalse(plugins.contains("gpsbabelgui"));
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r14149 r14153  
    2222import org.junit.runners.model.Statement;
    2323import org.openstreetmap.josm.JOSMFixture;
    24 import org.openstreetmap.josm.Main;
    2524import org.openstreetmap.josm.TestUtils;
    2625import org.openstreetmap.josm.actions.DeleteAction;
  • trunk/test/unit/org/openstreetmap/josm/testutils/PluginServer.java

    r14052 r14153  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.testutils;
     3
     4import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
    35
    46import java.io.File;
     
    1214import java.util.stream.Collectors;
    1315
     16import org.junit.runner.Description;
     17import org.junit.runners.model.Statement;
    1418import org.openstreetmap.josm.TestUtils;
    1519import org.openstreetmap.josm.tools.Logging;
    1620
    17 import org.junit.runner.Description;
    18 import org.junit.runners.model.Statement;
    19 
    20 import com.google.common.collect.ImmutableList;
    21 
     21import com.github.tomakehurst.wiremock.WireMockServer;
    2222import com.github.tomakehurst.wiremock.client.MappingBuilder;
    2323import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
     
    2525import com.github.tomakehurst.wiremock.core.Options;
    2626import com.github.tomakehurst.wiremock.junit.WireMockRule;
    27 import com.github.tomakehurst.wiremock.WireMockServer;
    28 
    29 import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
     27import com.google.common.collect.ImmutableList;
    3028
    3129public class PluginServer {
     
    7573
    7674        public String getRemotePluginsListManifestSection() {
    77             final Map<String, String> attrs = new HashMap<String, String>();
     75            final Map<String, String> attrs = new HashMap<>();
    7876            JarFile jarFile = null;
    7977
     
    239237            return super.apply(new Statement() {
    240238                @Override
    241                 @SuppressWarnings("unchecked")
    242239                public void evaluate() throws Throwable {
    243240                    PluginServer.this.applyToWireMockServer(PluginServerRule.this);
Note: See TracChangeset for help on using the changeset viewer.