Ignore:
Timestamp:
2024-07-29T17:57:38+02:00 (2 years ago)
Author:
taylor.smock
Message:

Fix tests broken by r19152

Location:
trunk/test/unit/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java

    r18870 r19155  
    1010import java.util.List;
    1111
     12import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
    1213import org.junit.jupiter.api.Test;
    1314import org.openstreetmap.gui.jmapviewer.FeatureAdapter;
     
    2122import org.openstreetmap.josm.testutils.annotations.Projection;
    2223
    23 import com.github.tomakehurst.wiremock.WireMockServer;
    24 
    2524/**
    2625 * Unit tests for class {@link AddImageryLayerAction}.
     
    3130@Projection
    3231final class AddImageryLayerActionTest {
    33     /**
    34      * HTTP mock.
    35      */
    36     @BasicWiremock
    37     WireMockServer wireMockServer;
    38 
    3932    /**
    4033     * Unit test of {@link AddImageryLayerAction#updateEnabledState}.
     
    6558     */
    6659    @Test
    67     void testActionPerformedEnabledWms() {
    68         wireMockServer.stubFor(get(urlEqualTo("/wms?apikey=random_key&SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1"))
     60    void testActionPerformedEnabledWms(WireMockRuntimeInfo wireMockRuntimeInfo) {
     61        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/wms?apikey=random_key&SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1"))
    6962                .willReturn(aResponse()
    7063                        .withStatus(200)
    7164                        .withHeader("Content-Type", "text/xml")
    7265                        .withBodyFile("imagery/wms-capabilities.xml")));
    73         wireMockServer.stubFor(get(urlEqualTo("/wms?apikey=random_key&SERVICE=WMS&REQUEST=GetCapabilities"))
     66        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/wms?apikey=random_key&SERVICE=WMS&REQUEST=GetCapabilities"))
    7467                .willReturn(aResponse()
    7568                        .withStatus(404)));
    76         wireMockServer.stubFor(get(urlEqualTo("/wms?apikey=random_key&SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0"))
     69        wireMockRuntimeInfo.getWireMock().register(get(urlEqualTo("/wms?apikey=random_key&SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0"))
    7770                .willReturn(aResponse()
    7871                        .withStatus(404)));
     
    8073        try {
    8174            FeatureAdapter.registerApiKeyAdapter(id -> "random_key");
    82             final ImageryInfo imageryInfo = new ImageryInfo("localhost", wireMockServer.url("/wms?apikey={apikey}"),
     75            final ImageryInfo imageryInfo = new ImageryInfo("localhost", wireMockRuntimeInfo.getHttpBaseUrl() + "/wms?apikey={apikey}",
    8376                    "wms_endpoint", null, null);
    8477            imageryInfo.setId("testActionPerformedEnabledWms");
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTaskTestParent.java

    r18893 r19155  
    66import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
    77
     8import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
     9import org.junit.jupiter.api.BeforeEach;
    810import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
    911import org.openstreetmap.josm.testutils.annotations.HTTPS;
    10 
    11 import com.github.tomakehurst.wiremock.WireMockServer;
    1212
    1313/**
     
    1717@HTTPS
    1818public abstract class AbstractDownloadTaskTestParent {
    19     /**
    20      * HTTP mock.
    21      */
    22     @BasicWiremock
    23     WireMockServer wireMockServer;
     19    WireMockRuntimeInfo wireMockServer;
     20    @BeforeEach
     21    void setup(WireMockRuntimeInfo wireMockRuntimeInfo) {
     22        this.wireMockServer = wireMockRuntimeInfo;
     23    }
    2424
    2525    /**
     
    4343     */
    4444    protected final String getRemoteFileUrl() {
    45         return wireMockServer.url(getRemoteFile());
     45        final String remote = getRemoteFile();
     46        if (remote.startsWith("/")) {
     47            return wireMockServer.getHttpBaseUrl() + getRemoteFile();
     48        }
     49        return wireMockServer.getHttpBaseUrl() + '/' + getRemoteFile();
    4650    }
    4751
     
    5054     */
    5155    protected final void mockHttp() {
    52         wireMockServer.stubFor(get(urlEqualTo("/" + getRemoteFile()))
     56        wireMockServer.getWireMock().register(get(urlEqualTo("/" + getRemoteFile()))
    5357                .willReturn(aResponse()
    5458                    .withStatus(200)
Note: See TracChangeset for help on using the changeset viewer.