Changeset 18050 in josm for trunk/test
- Timestamp:
- 2021-07-17T17:16:14+02:00 (3 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/WikimediaCommonsLoaderTest.java
r18037 r18050 11 11 import java.util.List; 12 12 13 import org.junit.jupiter.api.BeforeAll; 14 import org.junit.jupiter.api.Test; 13 15 import org.openstreetmap.josm.data.Bounds; 14 16 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 17 import org.openstreetmap.josm.tools.Http1Client; 18 import org.openstreetmap.josm.tools.HttpClient; 15 19 16 20 import com.github.tomakehurst.wiremock.WireMockServer; 17 import org.junit.jupiter.api.Test;18 21 19 22 /** … … 22 25 @BasicPreferences 23 26 class WikimediaCommonsLoaderTest { 27 28 @BeforeAll 29 static void beforeAll() { 30 HttpClient.setFactory(Http1Client::new); 31 } 32 24 33 /** 25 34 * Unit test of {@link WikimediaCommonsLoader} … … 45 54 } 46 55 47 private WireMockServer mockHttp() {48 String xml = "" +56 private static WireMockServer mockHttp() { 57 String xml = 49 58 "<api batchcomplete=\"\">\n" + 50 59 "<query>\n" + … … 57 66 final WireMockServer wireMock = new WireMockServer(options().dynamicPort()); 58 67 wireMock.stubFor(get(urlEqualTo("/w/api.php?format=xml&action=query&list=geosearch" + 59 "&gsnamespace=6&gslimit=500&gsprop=type |name&gsbbox=48.0|11.0|47.0|12.0"))68 "&gsnamespace=6&gslimit=500&gsprop=type%7Cname&gsbbox=48.0%7C11.0%7C47.0%7C12.0")) 60 69 .willReturn(aResponse().withBody(xml))); 61 70 return wireMock; -
trunk/test/unit/org/openstreetmap/josm/tools/MediawikiTest.java
r18046 r18050 34 34 // See https://josm.openstreetmap.de/ticket/21126 35 35 // Checks that URL can be converted to URI, needed for HTTP/2 36 // CHECKSTYLE.OFF: LineLength 36 37 assertEquals(new URI("https://commons.wikimedia.org/w/api.php?format=xml&action=query&list=geosearch&gsnamespace=6&gslimit=500&gsprop=type%7Cname&gsbbox=48.8623665%7C2.3913497%7C48.8600879%7C2.3967605"), 37 new URL(Mediawiki.getGeoImagesUrl("https://commons.wikimedia.org/w/api.php", new Bounds(48.8600879, 2.3913497, 48.8623665, 2.3967605))).toURI()); 38 new URL(Mediawiki.getGeoImagesUrl("https://commons.wikimedia.org/w/api.php", 39 new Bounds(48.8600879, 2.3913497, 48.8623665, 2.3967605))).toURI()); 40 // CHECKSTYLE.ON: LineLength 38 41 } 39 42 }
Note:
See TracChangeset
for help on using the changeset viewer.