Changeset 14081 in josm for trunk/test/unit/org
- Timestamp:
- 2018-08-04T01:59:46+02:00 (6 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r14068 r14081 47 47 import org.openstreetmap.josm.io.Compression; 48 48 import org.openstreetmap.josm.testutils.FakeGraphics; 49 import org.openstreetmap.josm.testutils.mockers.WindowMocker; 49 50 import org.openstreetmap.josm.tools.JosmRuntimeException; 50 51 import org.openstreetmap.josm.tools.Utils; … … 397 398 398 399 /** 400 * Use to assume that JMockit is working with the current JVM. 401 */ 402 public static void assumeWorkingJMockit() { 403 try { 404 // Workaround to https://github.com/jmockit/jmockit1/issues/534 405 // Inspired by https://issues.apache.org/jira/browse/SOLR-11606 406 new WindowMocker(); 407 } catch (UnsupportedOperationException e) { 408 Assume.assumeNoException(e); 409 } 410 } 411 412 /** 399 413 * Return WireMock server serving files under ticker directory 400 414 * @param ticketId Ticket numeric identifier -
trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java
r14052 r14081 7 7 import org.junit.Test; 8 8 import org.junit.contrib.java.lang.system.ExpectedSystemExit; 9 import org.openstreetmap.josm.TestUtils; 9 10 import org.openstreetmap.josm.gui.MainApplication; 10 11 import org.openstreetmap.josm.gui.progress.swing.ProgressMonitorExecutor; … … 12 13 import org.openstreetmap.josm.tools.ImageProvider; 13 14 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 14 16 import mockit.Invocation; 15 17 import mockit.Mock; 16 18 import mockit.MockUp; 17 18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;19 19 20 20 /** … … 28 28 @Rule 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 public JOSMTestRules test = new JOSMTestRules().platform() ;30 public JOSMTestRules test = new JOSMTestRules().platform().main(); 31 31 32 32 /** … … 41 41 @Test 42 42 public void testActionPerformed() { 43 TestUtils.assumeWorkingJMockit(); 43 44 exit.expectSystemExitWithStatus(0); 44 45 -
trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java
r14052 r14081 11 11 import org.junit.Rule; 12 12 import org.junit.Test; 13 import org.openstreetmap.josm.TestUtils; 13 14 import org.openstreetmap.josm.data.APIDataSet; 14 15 import org.openstreetmap.josm.data.coor.LatLon; … … 49 50 @Before 50 51 public void bootStrap() { 52 TestUtils.assumeWorkingJMockit(); 51 53 new JOptionPaneSimpleMocker(ImmutableMap.of( 52 54 "A background upload is already in progress. Kindly wait for it to finish before uploading new changes", JOptionPane.OK_OPTION -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java
r14052 r14081 7 7 import org.junit.Test; 8 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.TestUtils; 9 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 11 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; … … 30 31 @Test 31 32 public void testAction() { 33 TestUtils.assumeWorkingJMockit(); 32 34 new JOptionPaneSimpleMocker(ImmutableMap.of( 33 35 "All the preferences of this group are default, nothing to save", JOptionPane.OK_OPTION -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java
r14052 r14081 13 13 import org.junit.Rule; 14 14 import org.junit.Test; 15 import org.openstreetmap.josm.TestUtils; 15 16 import org.openstreetmap.josm.gui.ExtendedDialog; 16 17 import org.openstreetmap.josm.gui.preferences.advanced.PreferencesTable.AllSettingsTableModel; … … 50 51 @Test 51 52 public void testPreferencesTable() { 53 TestUtils.assumeWorkingJMockit(); 52 54 new JOptionPaneSimpleMocker(ImmutableMap.of( 53 55 "Please select the row to edit.", JOptionPane.OK_OPTION, -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java
r14062 r14081 39 39 40 40 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 41 import mockit.MockUp; 41 42 42 43 /** … … 393 394 @Test 394 395 public void testUpdateOnlySelectedPlugin() throws Exception { 396 TestUtils.assumeWorkingJMockit(); 395 397 final PluginServer pluginServer = new PluginServer( 396 398 new PluginServer.RemotePlugin(this.referenceDummyJarNew), … … 586 588 @Test 587 589 public void testUpdateWithNoAvailableUpdates() throws Exception { 590 TestUtils.assumeWorkingJMockit(); 588 591 final PluginServer pluginServer = new PluginServer( 589 592 new PluginServer.RemotePlugin(this.referenceDummyJarOld), … … 724 727 @Test 725 728 public void testInstallWithoutRestartRequired() throws Exception { 729 TestUtils.assumeWorkingJMockit(); 726 730 final boolean[] loadPluginsCalled = new boolean[] {false}; 727 new mockit.MockUp<PluginHandler>() {731 new MockUp<PluginHandler>() { 728 732 @mockit.Mock 729 733 private void loadPlugins( -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
r14052 r14081 96 96 @Test 97 97 public void testUpdatePluginsDownloadBoth() throws IOException { 98 TestUtils.assumeWorkingJMockit(); 98 99 final PluginServer pluginServer = new PluginServer( 99 100 new PluginServer.RemotePlugin(this.referenceDummyJarNew), … … 159 160 @Test 160 161 public void testUpdatePluginsSkipOne() throws IOException { 162 TestUtils.assumeWorkingJMockit(); 161 163 final PluginServer pluginServer = new PluginServer( 162 164 new PluginServer.RemotePlugin(this.referenceDummyJarNew), … … 237 239 @Test 238 240 public void testUpdatePluginsUnexpectedlyJOSMTooOld() throws IOException { 241 TestUtils.assumeWorkingJMockit(); 239 242 final PluginServer pluginServer = new PluginServer( 240 243 new PluginServer.RemotePlugin(this.referenceDummyJarNew), -
trunk/test/unit/org/openstreetmap/josm/testutils/mockers/WindowMocker.java
r14052 r14081 13 13 * MockUp for a {@link Window} which simply (and naively) makes its constructor(s) a no-op. This has 14 14 * the advantage of removing the isHeadless check. Though if course it also leaves you with 15 * unini ntialized objects, and so of course they don't *necessarily* work properly. But often they15 * uninitialized objects, and so of course they don't *necessarily* work properly. But often they 16 16 * work *just enough* to behave how a test needs them to. Exercise left to the reader to discover 17 17 * the limits here.
Note:
See TracChangeset
for help on using the changeset viewer.