Ignore:
Timestamp:
2018-07-26T22:01:31+02:00 (6 years ago)
Author:
Don-vip
Message:

see #16010 - use JMockit to enable more extensive test coverage (patch by ris, modified)

see https://github.com/openstreetmap/josm/pull/24/commits for details

Location:
trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java

    r11974 r14052  
    1010import java.util.Collections;
    1111
    12 import org.junit.BeforeClass;
     12import org.junit.Rule;
    1313import org.junit.Test;
    14 import org.openstreetmap.josm.JOSMFixture;
    1514import org.openstreetmap.josm.TestUtils;
    1615import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1918import org.openstreetmap.josm.plugins.PluginException;
    2019import org.openstreetmap.josm.plugins.PluginInformation;
     20import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker;
     21import org.openstreetmap.josm.testutils.JOSMTestRules;
     22
     23import com.google.common.collect.ImmutableMap;
     24
     25import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2126
    2227/**
     
    2429 */
    2530public class PluginPreferenceTest {
    26 
    2731    /**
    2832     * Setup test.
    2933     */
    30     @BeforeClass
    31     public static void setUpBeforeClass() {
    32         JOSMFixture.createUnitTestFixture().init();
    33     }
     34    @Rule
     35    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     36    public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT().platform();
    3437
    3538    /**
     
    4851    public static PluginInformation getDummyPluginInformation() throws PluginException {
    4952        return new PluginInformation(
    50                 new File(TestUtils.getTestDataRoot() + "plugin/dummy_plugin.jar"), "dummy_plugin");
     53                new File(TestUtils.getTestDataRoot() + "__files/plugin/dummy_plugin.v31772.jar"), "dummy_plugin");
    5154    }
    5255
     
    8992    @Test
    9093    public void testNotifyDownloadResults() {
     94        new HelpAwareOptionPaneMocker(ImmutableMap.<String, Object>builder()
     95            .put("<html></html>", "OK")  // (buildDownloadSummary() output was empty)
     96            .put("<html>Please restart JOSM to activate the downloaded plugins.</html>", "OK")
     97            .build()
     98        );
     99
    91100        PluginDownloadTask task = new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.<PluginInformation>emptyList(), "");
    92101        PluginPreference.notifyDownloadResults(null, task, false);
Note: See TracChangeset for help on using the changeset viewer.