kopia lustrzana https://github.com/JOSM/MapWithAI
Use cached version instead of live version for tests
MapWithAIActionTest was getting the live version of MapWithAI's current data area and caching it. The test for availability was expecting to use the cached data area. Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
6c2ccf650e
commit
df59a8e7dc
|
@ -1,6 +1,8 @@
|
||||||
// License: GPL. For details, see LICENSE file.
|
// License: GPL. For details, see LICENSE file.
|
||||||
package org.openstreetmap.josm.plugins.mapwithai.backend;
|
package org.openstreetmap.josm.plugins.mapwithai.backend;
|
||||||
|
|
||||||
|
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
|
||||||
|
import static org.awaitility.Awaitility.await;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
@ -11,11 +13,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import org.awaitility.Awaitility;
|
import org.awaitility.Awaitility;
|
||||||
import org.awaitility.Durations;
|
import org.awaitility.Durations;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.openstreetmap.josm.data.Bounds;
|
import org.openstreetmap.josm.data.Bounds;
|
||||||
import org.openstreetmap.josm.data.DataSource;
|
import org.openstreetmap.josm.data.DataSource;
|
||||||
|
import org.openstreetmap.josm.data.coor.LatLon;
|
||||||
import org.openstreetmap.josm.data.osm.DataSet;
|
import org.openstreetmap.josm.data.osm.DataSet;
|
||||||
import org.openstreetmap.josm.gui.MainApplication;
|
import org.openstreetmap.josm.gui.MainApplication;
|
||||||
import org.openstreetmap.josm.gui.Notification;
|
import org.openstreetmap.josm.gui.Notification;
|
||||||
|
@ -24,6 +28,8 @@ import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
||||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||||
import org.openstreetmap.josm.tools.Territories;
|
import org.openstreetmap.josm.tools.Territories;
|
||||||
|
|
||||||
|
import com.github.tomakehurst.wiremock.WireMockServer;
|
||||||
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
|
||||||
public class MapWithAIActionTest {
|
public class MapWithAIActionTest {
|
||||||
|
@ -33,10 +39,22 @@ public class MapWithAIActionTest {
|
||||||
|
|
||||||
private MapWithAIAction action;
|
private MapWithAIAction action;
|
||||||
|
|
||||||
|
WireMockServer wireMock = new WireMockServer(options().usingFilesUnderDirectory("test/resources/wiremock"));
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
action = new MapWithAIAction();
|
action = new MapWithAIAction();
|
||||||
|
wireMock.start(); // This is required to avoid failing a test in MapWithAIAvailabilityTest
|
||||||
|
MapWithAIAvailability.setReleaseUrl(
|
||||||
|
wireMock.baseUrl() + "/facebookmicrosites/Open-Mapping-At-Facebook/master/data/rapid_releases.geojson");
|
||||||
Territories.initialize();
|
Territories.initialize();
|
||||||
|
LatLon temp = new LatLon(40, -100);
|
||||||
|
await().atMost(Durations.TEN_SECONDS).until(() -> Territories.isIso3166Code("US", temp));
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
wireMock.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Ładowanie…
Reference in New Issue