Changeset 16159 in josm for trunk/test


Ignore:
Timestamp:
2020-03-17T20:09:38+01:00 (21 months ago)
Author:
simon04
Message:

see #18948 - Use Collections.singletonMap instead of ImmutableMap.of

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

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java

    r15455 r16159  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertNull;
     6
     7import java.util.Collections;
    68
    79import javax.swing.JLabel;
     
    2123import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
    2224import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    23 
    24 import com.google.common.collect.ImmutableMap;
    2525
    2626import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    8585        TestUtils.assumeWorkingJMockit();
    8686        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
    87             ImmutableMap.<String, Object>of("<html>There are no layers the source layer<br>'onion'<br>could be merged to.</html>", 0)
     87            Collections.singletonMap("<html>There are no layers the source layer<br>'onion'<br>could be merged to.</html>", 0)
    8888        );
    8989
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerTest.java

    r14410 r16159  
    3232import org.openstreetmap.josm.testutils.mockers.WindowMocker;
    3333
    34 import com.google.common.collect.ImmutableMap;
    35 
    3634import mockit.Invocation;
    3735import mockit.Mock;
     
    122120        TestUtils.assumeWorkingJMockit();
    123121        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
    124             ImmutableMap.<String, Object>of(
     122            Collections.singletonMap(
    125123                "<html>JOSM is currently running with an anonymous user. It cannot download<br>"
    126124                + "your changesets from the OSM server unless you enter your OSM user name<br>"
  • trunk/test/unit/org/openstreetmap/josm/gui/help/HelpBrowserTest.java

    r14807 r16159  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertNull;
     6
     7import java.util.Collections;
    68
    79import javax.swing.JOptionPane;
     
    1618import org.openstreetmap.josm.tools.PlatformManager;
    1719
    18 import com.google.common.collect.ImmutableMap;
    19 
    2020import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2121import mockit.Expectations;
     
    157157        }};
    158158        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
    159             ImmutableMap.<String, Object>of(
     159            Collections.singletonMap(
    160160                "<html>The current URL <tt>https://josm.openstreetmap.de/javadoc</tt><br>is an external "
    161161                + "URL. Editing is only possible for help topics<br>on the help server "
  • trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java

    r14187 r16159  
    22package org.openstreetmap.josm.gui.io;
    33
     4import java.util.Collections;
    45import java.util.Optional;
    56
     
    2223import org.openstreetmap.josm.testutils.JOSMTestRules;
    2324import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    24 
    25 import com.google.common.collect.ImmutableMap;
    2625
    2726import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    9089    public void testSingleUploadInstance() {
    9190        TestUtils.assumeWorkingJMockit();
    92         new JOptionPaneSimpleMocker(ImmutableMap.of(
     91        new JOptionPaneSimpleMocker(Collections.singletonMap(
    9392                "A background upload is already in progress. Kindly wait for it to finish before uploading new changes", JOptionPane.OK_OPTION
    9493            ));
  • trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java

    r14366 r16159  
    99import java.awt.GraphicsEnvironment;
    1010import java.net.URL;
     11import java.util.Collections;
    1112
    1213import javax.swing.JOptionPane;
     
    2223import org.openstreetmap.josm.testutils.mockers.WindowMocker;
    2324import org.openstreetmap.josm.tools.UserCancelException;
    24 
    25 import com.google.common.collect.ImmutableMap;
    2625
    2726import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    8079        final OAuthWizardMocker oaWizardMocker = new OAuthWizardMocker();
    8180        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
    82             ImmutableMap.<String, Object>of(
     81            Collections.singletonMap(
    8382                "<html>Could not retrieve the list of your open changesets because<br>JOSM does not know "
    8483                + "your identity.<br>You have either chosen to work anonymously or you are not "
     
    113112        final OAuthWizardMocker oaWizardMocker = new OAuthWizardMocker();
    114113        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
    115             ImmutableMap.<String, Object>of("There are no open changesets", JOptionPane.OK_OPTION)
     114            Collections.singletonMap("There are no open changesets", JOptionPane.OK_OPTION)
    116115        );
    117116
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r15502 r16159  
    1212import java.text.DateFormat;
    1313import java.util.Collection;
     14import java.util.Collections;
    1415import java.util.Iterator;
    1516
     
    3940import org.openstreetmap.josm.tools.Logging;
    4041import org.openstreetmap.josm.tools.date.DateUtils;
    41 
    42 import com.google.common.collect.ImmutableMap;
    4342
    4443import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    295294        TestUtils.assumeWorkingJMockit();
    296295        final ExtendedDialogMocker edMocker = new ExtendedDialogMocker(
    297             ImmutableMap.<String, Object>of("The document contains no data.", "Cancel")
     296            Collections.singletonMap("The document contains no data.", "Cancel")
    298297        );
    299298
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackActionTest.java

    r14138 r16159  
    55import static org.junit.Assert.assertNotNull;
    66import static org.junit.Assert.assertNull;
     7
     8import java.util.Collections;
    79
    810import org.junit.Rule;
     
    1719import org.openstreetmap.josm.testutils.JOSMTestRules;
    1820import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker;
    19 
    20 import com.google.common.collect.ImmutableMap;
    2121
    2222import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    3636    private static PleaseWaitRunnable createTask(String file) throws Exception {
    3737        // click "Download" when presented with the appropriate HelpAwareOptionPane
    38         final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(ImmutableMap.of(
     38        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(Collections.singletonMap(
    3939            "DownloadAlongPanel", "Download"
    4040        )) {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java

    r14332 r16159  
    77import static org.junit.Assert.assertNull;
    88import static org.junit.Assert.assertTrue;
     9
     10import java.util.Collections;
    911
    1012import org.awaitility.Awaitility;
     
    2123import org.openstreetmap.josm.testutils.TileSourceRule;
    2224import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    23 
    24 import com.google.common.collect.ImmutableMap;
    2525
    2626import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    4545        TestUtils.assumeWorkingJMockit();
    4646        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
    47             ImmutableMap.<String, Object>of("There are no imagery layers.", 0)
     47            Collections.singletonMap("There are no imagery layers.", 0)
    4848        );
    4949
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java

    r14149 r16159  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.preferences.advanced;
     3
     4import java.util.Collections;
    35
    46import javax.swing.JOptionPane;
     
    1012import org.openstreetmap.josm.testutils.JOSMTestRules;
    1113import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    12 
    13 import com.google.common.collect.ImmutableMap;
    1414
    1515import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    3232    public void testAction() {
    3333        TestUtils.assumeWorkingJMockit();
    34         new JOptionPaneSimpleMocker(ImmutableMap.of(
     34        new JOptionPaneSimpleMocker(Collections.singletonMap(
    3535            "All the preferences of this group are default, nothing to save", JOptionPane.OK_OPTION
    3636        ));
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java

    r14213 r16159  
    1212import java.nio.file.Files;
    1313import java.util.Collection;
     14import java.util.Collections;
    1415
    1516import javax.swing.JOptionPane;
     
    3536import com.github.tomakehurst.wiremock.junit.WireMockRule;
    3637import com.google.common.collect.ImmutableList;
    37 import com.google.common.collect.ImmutableMap;
    3838
    3939import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    137137            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
    138138            new PluginServer.RemotePlugin(this.referenceBazJarOld),
    139             new PluginServer.RemotePlugin(null, ImmutableMap.of("Plugin-Version", "2"), "irrelevant_plugin")
     139            new PluginServer.RemotePlugin(null, Collections.singletonMap("Plugin-Version", "2"), "irrelevant_plugin")
    140140        );
    141141        pluginServer.applyToWireMockServer(this.pluginServerRule);
     
    143143
    144144        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
    145             ImmutableMap.<String, Object>of(
     145            Collections.singletonMap(
    146146                "<html>The following plugin has been downloaded <strong>successfully</strong>:"
    147147                + "<ul><li>baz_plugin (6)</li></ul>"
     
    268268
    269269        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
    270             ImmutableMap.<String, Object>of(
     270            Collections.singletonMap(
    271271                "<html>You have to restart JOSM for some settings to take effect."
    272272                + "<br/><br/>Would you like to restart now?</html>",
     
    581581            new PluginServer.RemotePlugin(this.referenceDummyJarOld),
    582582            new PluginServer.RemotePlugin(this.referenceBazJarOld),
    583             new PluginServer.RemotePlugin(null, ImmutableMap.of("Plugin-Version", "123"), "irrelevant_plugin")
     583            new PluginServer.RemotePlugin(null, Collections.singletonMap("Plugin-Version", "123"), "irrelevant_plugin")
    584584        );
    585585        pluginServer.applyToWireMockServer(this.pluginServerRule);
     
    587587
    588588        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
    589             ImmutableMap.<String, Object>of(
     589            Collections.singletonMap(
    590590                "All installed plugins are up to date. JOSM does not have to download newer versions.",
    591591                "OK"
     
    740740
    741741        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker();
    742         final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(ImmutableMap.<String, Object>of(
     742        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(Collections.singletonMap(
    743743            "<html>The following plugin has been downloaded <strong>successfully</strong>:"
    744744            + "<ul><li>dummy_plugin (31772)</li></ul></html>",
     
    845845        final PluginServer pluginServer = new PluginServer(
    846846            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
    847             new PluginServer.RemotePlugin(this.referenceBazJarNew, ImmutableMap.of(
     847            new PluginServer.RemotePlugin(this.referenceBazJarNew, Collections.singletonMap(
    848848                "6800_Plugin-Url", "6;http://localhost:" + this.pluginServerRule.port() + bazOldServePath
    849849            ))
     
    860860        Config.getPref().putList("plugins", ImmutableList.of());
    861861
    862         final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(ImmutableMap.of(
     862        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(Collections.singletonMap(
    863863            "<html>The following plugin has been downloaded <strong>successfully</strong>:"
    864864            + "<ul><li>baz_plugin (6)</li></ul>"
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java

    r14213 r16159  
    1010import java.io.IOException;
    1111import java.nio.file.Files;
     12import java.util.Collections;
    1213import java.util.List;
    1314
     
    254255        final PluginServer pluginServer = new PluginServer(
    255256            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
    256             new PluginServer.RemotePlugin(this.referenceBazJarNew, ImmutableMap.of(
    257                 "Plugin-Mainversion", "5500"
    258             ))
     257            new PluginServer.RemotePlugin(this.referenceBazJarNew, Collections.singletonMap("Plugin-Mainversion", "5500"))
    259258        );
    260259        pluginServer.applyToWireMockServer(this.pluginServerRule);
     
    312311        final PluginServer pluginServer = new PluginServer(
    313312            new PluginServer.RemotePlugin(this.referenceBazJarOld),
    314             new PluginServer.RemotePlugin(this.referenceQuxJarNewer, ImmutableMap.of(
     313            new PluginServer.RemotePlugin(this.referenceQuxJarNewer, Collections.singletonMap(
    315314                "7499_Plugin-Url", "346;http://localhost:" + this.pluginServerRule.port() + "/dont/bother.jar"
    316315            ))
     
    319318        Config.getPref().putList("plugins", ImmutableList.of("qux_plugin", "baz_plugin"));
    320319
    321         new ExtendedDialogMocker(ImmutableMap.of("JOSM version 7,500 required for plugin qux_plugin.", "Download Plugin"));
     320        new ExtendedDialogMocker(Collections.singletonMap("JOSM version 7,500 required for plugin qux_plugin.", "Download Plugin"));
    322321
    323322        Files.copy(this.referenceQuxJarOld.toPath(), this.targetQuxJar.toPath());
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java

    r15737 r16159  
    99import java.util.ArrayList;
    1010import java.util.Arrays;
     11import java.util.Collections;
    1112import java.util.List;
    1213import java.util.stream.Collectors;
     
    2728import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker;
    2829import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    29 
    30 import com.google.common.collect.ImmutableMap;
    3130
    3231import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    104103        TestUtils.assumeWorkingJMockit();
    105104        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
    106             ImmutableMap.<String, Object>of(
     105            Collections.singletonMap(
    107106                "<html>The following plugin is no longer necessary and has been deactivated:" +
    108107                    "<ul><li>imagery (integrated into main program)</li></ul></html>",
     
    129128        TestUtils.assumeWorkingJMockit();
    130129        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
    131             ImmutableMap.<String, Object>of(
     130            Collections.singletonMap(
    132131                "<html>Loading of the plugin \"gpsbabelgui\" was requested.<br>" +
    133132                    "This plugin is no longer developed and very likely will produce errors.<br>" +
Note: See TracChangeset for help on using the changeset viewer.