From 79a2a00607b2afd46dd5d7c857bc2203db6f3c79 Mon Sep 17 00:00:00 2001
From: Robert Scott <code@humanleg.org.uk>
Date: Tue, 27 Mar 2018 19:21:17 +0100
Subject: [PATCH v2 12/28] PluginPreferenceTest: convert to use of
HelpAwareOptionPaneMocker
---
.../preferences/plugin/PluginPreferenceTest.java | 23 +++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
index 9731f9e34..7c89cd081 100644
a
|
b
|
import java.util.Arrays;
|
9 | 9 | import java.util.Collection; |
10 | 10 | import java.util.Collections; |
11 | 11 | |
12 | | import org.junit.BeforeClass; |
| 12 | import org.junit.Rule; |
13 | 13 | import org.junit.Test; |
14 | | import org.openstreetmap.josm.JOSMFixture; |
15 | 14 | import org.openstreetmap.josm.TestUtils; |
16 | 15 | import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; |
17 | 16 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor; |
18 | 17 | import org.openstreetmap.josm.plugins.PluginDownloadTask; |
19 | 18 | import org.openstreetmap.josm.plugins.PluginException; |
20 | 19 | import org.openstreetmap.josm.plugins.PluginInformation; |
| 20 | import org.openstreetmap.josm.testutils.HelpAwareOptionPaneMocker; |
| 21 | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 22 | |
| 23 | import com.google.common.collect.ImmutableMap; |
| 24 | |
| 25 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
21 | 26 | |
22 | 27 | /** |
23 | 28 | * Unit tests of {@link PluginPreference} class. |
24 | 29 | */ |
25 | 30 | public class PluginPreferenceTest { |
26 | | |
27 | 31 | /** |
28 | 32 | * Setup test. |
29 | 33 | */ |
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(); |
34 | 37 | |
35 | 38 | /** |
36 | 39 | * Unit test of {@link PluginPreference#PluginPreference}. |
… |
… |
public class PluginPreferenceTest {
|
88 | 91 | */ |
89 | 92 | @Test |
90 | 93 | 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 | |
91 | 100 | PluginDownloadTask task = new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.<PluginInformation>emptyList(), ""); |
92 | 101 | PluginPreference.notifyDownloadResults(null, task, false); |
93 | 102 | PluginPreference.notifyDownloadResults(null, task, true); |