- Timestamp:
- 2020-10-08T22:32:52+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/WebMarkerTest.java
r14412 r17125 2 2 package org.openstreetmap.josm.gui.layer.markerlayer; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.net.URL; 7 7 8 import org.junit.BeforeClass; 9 import org.junit.Test; 10 import org.openstreetmap.josm.JOSMFixture; 8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 11 10 import org.openstreetmap.josm.TestUtils; 12 11 import org.openstreetmap.josm.data.coor.LatLon; 13 12 import org.openstreetmap.josm.data.gpx.GpxData; 14 13 import org.openstreetmap.josm.data.gpx.WayPoint; 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 15 import org.openstreetmap.josm.tools.PlatformManager; 16 16 import org.openstreetmap.josm.tools.PlatformHook; 17 17 18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 18 19 19 20 import mockit.Expectations; 20 21 import mockit.Injectable; 22 import mockit.Mocked; 21 23 22 24 /** … … 28 30 * Setup tests 29 31 */ 30 @BeforeClass 31 public static void setUpBeforeClass() { 32 JOSMFixture.createUnitTestFixture().init(); 33 } 32 @RegisterExtension 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 public JOSMTestRules test = new JOSMTestRules().preferences().https(); 34 35 35 36 /** 36 37 * Unit test of {@link WebMarker#WebMarker}. 37 38 * @param mockPlatformHook platform hook mock 39 * @param platformManager {@link PlatformManager} mock 38 40 * @throws Exception in case of error 39 41 */ 40 42 @Test 41 public void testWebMarker(@Injectable final PlatformHook mockPlatformHook) throws Exception { 43 public void testWebMarker(@Injectable final PlatformHook mockPlatformHook, 44 @Mocked final PlatformManager platformManager) throws Exception { 42 45 TestUtils.assumeWorkingJMockit(); 43 new Expectations( PlatformManager.class) {{46 new Expectations() {{ 44 47 PlatformManager.getPlatform(); result = mockPlatformHook; 45 }};46 new Expectations() {{47 48 mockPlatformHook.openUrl("http://example.com"); result = null; times = 1; 48 49 }};
Note:
See TracChangeset
for help on using the changeset viewer.