Search in sources :

Example 6 with WireMockTestClient

use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.

the class StubRequestLoggingAcceptanceTest method logsEventsToNotifierWhenNotDisabled.

@Test
public void logsEventsToNotifierWhenNotDisabled() {
    TestNotifier notifier = new TestNotifier();
    WireMockServer wm = new WireMockServer(wireMockConfig().dynamicPort().notifier(notifier));
    wm.start();
    testClient = new WireMockTestClient(wm.port());
    wm.stubFor(get("/log-me").willReturn(ok("body text")));
    testClient.get("/log-me");
    assertThat(notifier.infoMessages.size(), is(1));
    assertThat(notifier.infoMessages.get(0), allOf(containsString("Request received:"), containsString("/log-me"), containsString("body text")));
}
Also used : WireMockTestClient(com.github.tomakehurst.wiremock.testsupport.WireMockTestClient) Test(org.junit.jupiter.api.Test)

Example 7 with WireMockTestClient

use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.

the class MappingsLoaderAcceptanceTest method buildWireMock.

private void buildWireMock(Options options) {
    wireMockServer = new WireMockServer(options);
    wireMockServer.start();
    testClient = new WireMockTestClient(wireMockServer.port());
}
Also used : WireMockTestClient(com.github.tomakehurst.wiremock.testsupport.WireMockTestClient)

Example 8 with WireMockTestClient

use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.

the class MultithreadConfigurationInheritanceTest method setup.

@BeforeAll
public static void setup() {
    wireMockServer = new WireMockServer(0);
    wireMockServer.start();
    WireMock.configureFor(wireMockServer.port());
    client = new WireMockTestClient(wireMockServer.port());
}
Also used : WireMockTestClient(com.github.tomakehurst.wiremock.testsupport.WireMockTestClient) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 9 with WireMockTestClient

use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.

the class RecordingDslAcceptanceTest method init.

@BeforeEach
public void init() {
    fileRoot = setupTempFileRoot();
    proxyingService = new WireMockServer(wireMockConfig().dynamicPort().withRootDirectory(fileRoot.getAbsolutePath()));
    proxyingService.start();
    targetService = wireMockServer;
    targetBaseUrl = "http://localhost:" + targetService.port();
    client = new WireMockTestClient(proxyingService.port());
    WireMock.configureFor(proxyingService.port());
    adminClient = WireMock.create().port(proxyingService.port()).build();
}
Also used : WireMockTestClient(com.github.tomakehurst.wiremock.testsupport.WireMockTestClient) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with WireMockTestClient

use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.

the class ResponseDefinitionTransformerAcceptanceTest method startWithExtensions.

private void startWithExtensions(String... extensions) {
    wm = new WireMockServer(wireMockConfig().dynamicPort().withRootDirectory(defaultTestFilesRoot()).extensions(extensions));
    wm.start();
    client = new WireMockTestClient(wm.port());
}
Also used : WireMockTestClient(com.github.tomakehurst.wiremock.testsupport.WireMockTestClient)

Aggregations

WireMockTestClient (com.github.tomakehurst.wiremock.testsupport.WireMockTestClient)43 Test (org.junit.jupiter.api.Test)16 BeforeEach (org.junit.jupiter.api.BeforeEach)10 WireMockResponse (com.github.tomakehurst.wiremock.testsupport.WireMockResponse)9 WireMockServer (com.github.tomakehurst.wiremock.WireMockServer)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 BeforeAll (org.junit.jupiter.api.BeforeAll)3 SingleRootFileSource (com.github.tomakehurst.wiremock.common.SingleRootFileSource)2 WebAppContext (org.eclipse.jetty.webapp.WebAppContext)2 FileSource (com.github.tomakehurst.wiremock.common.FileSource)1 ProxySettings (com.github.tomakehurst.wiremock.common.ProxySettings)1 Request (com.github.tomakehurst.wiremock.http.Request)1 X509KeyStore (com.github.tomakehurst.wiremock.http.ssl.X509KeyStore)1 WireMockServerRunner (com.github.tomakehurst.wiremock.standalone.WireMockServerRunner)1 Stopwatch (com.google.common.base.Stopwatch)1 Certificate (java.security.cert.Certificate)1 Collections.singletonList (java.util.Collections.singletonList)1 List (java.util.List)1 ExecutorService (java.util.concurrent.ExecutorService)1 Future (java.util.concurrent.Future)1