use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class ResponseDefinitionTransformerAcceptanceTest method supportsSpecifiyingExtensionsByInstance.
@Test
public void supportsSpecifiyingExtensionsByInstance() {
wm = new WireMockServer(wireMockConfig().dynamicPort().extensions(new ExampleTransformer(), new MultiTransformer2()));
wm.start();
client = new WireMockTestClient(wm.port());
createStub("/to-instance-transform");
WireMockResponse response = client.get("/to-instance-transform");
assertThat(response.statusCode(), is(200));
assertThat(response.content(), is("Expect this"));
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class ResponseDefinitionTransformerAcceptanceTest method supportsSpecifiyingExtensionsByClass.
@Test
public void supportsSpecifiyingExtensionsByClass() {
wm = new WireMockServer(wireMockConfig().dynamicPort().extensions(ExampleTransformer.class, MultiTransformer1.class));
wm.start();
client = new WireMockTestClient(wm.port());
createStub("/to-class-transform");
WireMockResponse response = client.get("/to-class-transform");
assertThat(response.statusCode(), is(201));
assertThat(response.content(), is("Transformed body"));
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class NotMatchedPageAcceptanceTest method configure.
private void configure(WireMockConfiguration options) {
options.dynamicPort().withRootDirectory("src/test/resources/empty");
wm = new WireMockServer(options);
wm.start();
testClient = new WireMockTestClient(wm.port());
WireMock.configureFor(wm.port());
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class PortNumberTest method canRunOnAnotherPortThan8080.
@Test
public void canRunOnAnotherPortThan8080() {
int port = Network.findFreePort();
WireMockServer wireMockServer = createServer(wireMockConfig().port(port));
wireMockServer.start();
WireMockTestClient wireMockClient = new WireMockTestClient(port);
wireMockClient.addResponse(MappingJsonSamples.BASIC_MAPPING_REQUEST_WITH_RESPONSE_HEADER);
WireMockResponse response = wireMockClient.get("/a/registered/resource");
assertThat(response.statusCode(), is(401));
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient in project wiremock by wiremock.
the class ProxyAcceptanceTest method init.
void init(WireMockConfiguration proxyingServiceOptions) {
targetService = new WireMockServer(wireMockConfig().dynamicPort().dynamicHttpsPort().bindAddress("127.0.0.1").stubCorsEnabled(true));
targetService.start();
target = WireMock.create().host("localhost").port(targetService.port()).build();
targetServiceBaseUrl = "http://localhost:" + targetService.port();
proxyingServiceOptions.dynamicPort().bindAddress("127.0.0.1");
proxyingService = new WireMockServer(proxyingServiceOptions);
proxyingService.start();
proxy = WireMock.create().port(proxyingService.port()).build();
testClient = new WireMockTestClient(proxyingService.port());
WireMock.configureFor(targetService.port());
}
Aggregations