Changeset 15737 in josm for trunk/test/unit
- Timestamp:
- 2020-01-20T01:16:42+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java
r15723 r15737 13 13 import java.util.stream.Stream; 14 14 15 import javax.swing.JOptionPane; 15 16 import javax.swing.JScrollPane; 16 17 … … 26 27 import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker; 27 28 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; 29 28 30 import com.google.common.collect.ImmutableMap; 29 31 … … 58 60 public void testBuildListOfPluginsToLoad() { 59 61 TestUtils.assumeWorkingJMockit(); 60 final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker() { 61 @Override 62 public String getStringFromMessage(final Object message) { 63 return ((String) message).substring(0, 66); 64 } 65 }; 66 haMocker.getMockResultMap().put( 67 "<html>JOSM could not find information about the following plugins:", 68 "OK" 69 ); 62 final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker( 63 PluginHandler.UNMAINTAINED_PLUGINS.stream().collect( 64 Collectors.toMap(PluginHandler::getUnmaintainedPluginMessage, p -> "Disable plugin"))); 65 final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(); 66 jopsMocker.getMockResultMap().put( 67 PluginHandler.getRemovedPluginsMessage(PluginHandler.DEPRECATED_PLUGINS), 68 JOptionPane.OK_OPTION 69 ); 70 70 final String old = System.getProperty("josm.plugins"); 71 71 try { … … 86 86 } 87 87 88 assertEquals(1, haMocker.getInvocationLog().size());89 Object[] invocationLogEntry = haMocker.getInvocationLog().get(0);88 assertEquals(1, jopsMocker.getInvocationLog().size()); 89 Object[] invocationLogEntry = jopsMocker.getInvocationLog().get(0); 90 90 assertEquals(0, (int) invocationLogEntry[0]); 91 91 assertEquals("Warning", invocationLogEntry[2]); 92 93 assertEquals(PluginHandler.UNMAINTAINED_PLUGINS.size(), haMocker.getInvocationLog().size()); 94 invocationLogEntry = haMocker.getInvocationLog().get(0); 95 assertEquals(0, (int) invocationLogEntry[0]); 96 assertEquals("Disable plugin", invocationLogEntry[2]); 92 97 } 93 98
Note:
See TracChangeset
for help on using the changeset viewer.