Changeset 18050 in josm for trunk/test


Ignore:
Timestamp:
2021-07-17T17:16:14+02:00 (3 years ago)
Author:
Don-vip
Message:

see #17606 - see #21126 - fixes

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  
    1111import java.util.List;
    1212
     13import org.junit.jupiter.api.BeforeAll;
     14import org.junit.jupiter.api.Test;
    1315import org.openstreetmap.josm.data.Bounds;
    1416import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     17import org.openstreetmap.josm.tools.Http1Client;
     18import org.openstreetmap.josm.tools.HttpClient;
    1519
    1620import com.github.tomakehurst.wiremock.WireMockServer;
    17 import org.junit.jupiter.api.Test;
    1821
    1922/**
     
    2225@BasicPreferences
    2326class WikimediaCommonsLoaderTest {
     27
     28    @BeforeAll
     29    static void beforeAll() {
     30        HttpClient.setFactory(Http1Client::new);
     31    }
     32
    2433    /**
    2534     * Unit test of {@link WikimediaCommonsLoader}
     
    4554    }
    4655
    47     private WireMockServer mockHttp() {
    48         String xml = "" +
     56    private static WireMockServer mockHttp() {
     57        String xml =
    4958                "<api batchcomplete=\"\">\n" +
    5059                "<query>\n" +
     
    5766        final WireMockServer wireMock = new WireMockServer(options().dynamicPort());
    5867        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"))
    6069                .willReturn(aResponse().withBody(xml)));
    6170        return wireMock;
  • trunk/test/unit/org/openstreetmap/josm/tools/MediawikiTest.java

    r18046 r18050  
    3434        // See https://josm.openstreetmap.de/ticket/21126
    3535        // Checks that URL can be converted to URI, needed for HTTP/2
     36        // CHECKSTYLE.OFF: LineLength
    3637        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
    3841    }
    3942}
Note: See TracChangeset for help on using the changeset viewer.