Changeset 17194 in josm
- Timestamp:
- 2020-10-13T22:07:11+02:00 (4 years ago)
- Location:
- trunk/test
- Files:
-
- 11 added
- 2 edited
- 1 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTaskTest.java
r17192 r17194 58 58 @Test 59 59 public void testNominalUrl() { 60 ApiUrlTestTask task = new ApiUrlTestTask(PARENT, wireMockRule.url("/__files/ osm_api"));60 ApiUrlTestTask task = new ApiUrlTestTask(PARENT, wireMockRule.url("/__files/api")); 61 61 task.run(); 62 62 assertTrue(task.isSuccess()); -
trunk/test/unit/org/openstreetmap/josm/io/CapabilitiesTest.java
r17193 r17194 24 24 public void testCapabilities() throws Exception { 25 25 final Capabilities capabilities; 26 try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("__files/ osm_api/0.6/capabilities")) {26 try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("__files/api/0.6/capabilities")) { 27 27 capabilities = Capabilities.CapabilitiesParser.parse(new InputSource(inputStream)); 28 28 } -
trunk/test/unit/org/openstreetmap/josm/io/OsmServerHistoryReaderTest.java
r17193 r17194 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit.Assert.assertTrue; 4 import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; 5 import static org.junit.Assert.assertEquals; 5 6 6 import org.junit.BeforeClass; 7 import org.junit.Before; 8 import org.junit.Rule; 7 9 import org.junit.Test; 8 10 import org.openstreetmap.josm.JOSMFixture; 11 import org.openstreetmap.josm.TestUtils; 9 12 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 10 13 import org.openstreetmap.josm.data.osm.history.History; … … 13 16 import org.openstreetmap.josm.spi.preferences.Config; 14 17 18 import com.github.tomakehurst.wiremock.junit.WireMockRule; 19 15 20 /** 16 * History fetching tests. This test operates with production API.21 * Unit tests of {@link OsmServerHistoryReader} class. 17 22 */ 18 23 public class OsmServerHistoryReaderTest { 19 24 20 25 /** 26 * HTTP mock. 27 */ 28 @Rule 29 public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort().usingFilesUnderDirectory(TestUtils.getTestDataRoot())); 30 31 /** 21 32 * Setup tests. 22 33 */ 23 @Before Class24 public static void init() {34 @Before 35 public void setUp() { 25 36 JOSMFixture.createUnitTestFixture().init(); 26 Config.getPref().put("osm-server.url", Config.getUrls().getDefaultOsmApiUrl());37 Config.getPref().put("osm-server.url", wireMockRule.url("/__files/api")); 27 38 } 28 39 … … 36 47 HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE); 37 48 History h = ds.getHistory(266187, OsmPrimitiveType.NODE); 38 assertTrue("NumVersions", h.getNumVersions() >= 4); 49 assertEquals(5, h.getNumVersions()); 50 assertEquals(1, h.getLatest().getNumKeys()); 51 assertEquals(65565982, h.getLatest().getChangesetId()); 52 assertEquals(1545089885000L, h.getLatest().getTimestamp().getTime()); 39 53 } 40 54 … … 48 62 HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE); 49 63 History h = ds.getHistory(3058844, OsmPrimitiveType.WAY); 50 assertTrue("NumVersions", h.getNumVersions() >= 13); 64 assertEquals(14, h.getNumVersions()); 65 assertEquals(10, h.getLatest().getNumKeys()); 66 assertEquals(26368284, h.getLatest().getChangesetId()); 67 assertEquals(1414429134000L, h.getLatest().getTimestamp().getTime()); 51 68 } 52 69 … … 60 77 HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE); 61 78 History h = ds.getHistory(49, OsmPrimitiveType.RELATION); 62 assertTrue("NumVersions", h.getNumVersions() >= 3); 79 assertEquals(3, h.getNumVersions()); 80 assertEquals(0, h.getLatest().getNumKeys()); 81 assertEquals(486501, h.getLatest().getChangesetId()); 82 assertEquals(1194886166000L, h.getLatest().getTimestamp().getTime()); 63 83 } 64 84 }
Note:
See TracChangeset
for help on using the changeset viewer.