Search in sources :

Example 56 with UrlPathPattern

use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class WireMockServer method stubMatching.

public void stubMatching(RequestMethod method, String pattern, Supplier<ResponseDefinitionBuilder> supplier) {
    UrlPathPattern matcher = WireMock.urlPathMatching(pattern);
    MappingBuilder request = WireMock.request(method.getName(), matcher);
    ResponseDefinitionBuilder response = supplier.get();
    stubFor(request.willReturn(response));
}
Also used : ResponseDefinitionBuilder(com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder) MappingBuilder(com.github.tomakehurst.wiremock.client.MappingBuilder) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern)

Example 57 with UrlPathPattern

use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class WireMockServer method stubMatching.

public void stubMatching(RequestMethod method, String pattern, Consumer<ResponseDefinitionBuilder> consumer) {
    UrlPathPattern matcher = WireMock.urlPathMatching(pattern);
    MappingBuilder request = WireMock.request(method.getName(), matcher);
    ResponseDefinitionBuilder response = WireMock.aResponse();
    consumer.accept(response);
    stubFor(request.willReturn(response));
}
Also used : ResponseDefinitionBuilder(com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder) MappingBuilder(com.github.tomakehurst.wiremock.client.MappingBuilder) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern)

Example 58 with UrlPathPattern

use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class WireMockServer method stubMatching.

public void stubMatching(RequestMethod method, String pattern, StringValuePattern bodyPatter, Consumer<ResponseDefinitionBuilder> consumer) {
    UrlPathPattern matcher = WireMock.urlPathMatching(pattern);
    MappingBuilder request = WireMock.request(method.getName(), matcher).withRequestBody(bodyPatter);
    ResponseDefinitionBuilder response = WireMock.aResponse();
    consumer.accept(response);
    stubFor(request.willReturn(response));
}
Also used : ResponseDefinitionBuilder(com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder) MappingBuilder(com.github.tomakehurst.wiremock.client.MappingBuilder) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern)

Example 59 with UrlPathPattern

use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class WireMockServer method stubMatching.

public void stubMatching(RequestMethod method, String pattern, ContentPattern<?> content, Supplier<ResponseDefinitionBuilder> supplier) {
    UrlPathPattern matcher = WireMock.urlPathMatching(pattern);
    MappingBuilder request = WireMock.request(method.getName(), matcher).withRequestBody(content);
    ResponseDefinitionBuilder response = supplier.get();
    stubFor(request.willReturn(response));
}
Also used : ResponseDefinitionBuilder(com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder) MappingBuilder(com.github.tomakehurst.wiremock.client.MappingBuilder) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern)

Example 60 with UrlPathPattern

use of com.github.tomakehurst.wiremock.matching.UrlPathPattern in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class WireMockServer method stubMatching.

public void stubMatching(RequestMethod method, String pattern, StringValuePattern bodyPatter, Supplier<ResponseDefinitionBuilder> supplier) {
    UrlPathPattern matcher = WireMock.urlPathMatching(pattern);
    MappingBuilder request = WireMock.request(method.getName(), matcher).withRequestBody(bodyPatter);
    ResponseDefinitionBuilder response = supplier.get();
    stubFor(request.willReturn(response));
}
Also used : ResponseDefinitionBuilder(com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder) MappingBuilder(com.github.tomakehurst.wiremock.client.MappingBuilder) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern)

Aggregations

UrlPathPattern (com.github.tomakehurst.wiremock.matching.UrlPathPattern)112 RegexPattern (com.github.tomakehurst.wiremock.matching.RegexPattern)84 Test (org.junit.Test)76 ResponseDefinitionBuilder (com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder)54 Async (io.vertx.ext.unit.Async)42 Before (org.junit.Before)33 EqualToPattern (com.github.tomakehurst.wiremock.matching.EqualToPattern)28 Matchers.containsString (org.hamcrest.Matchers.containsString)26 JsonObject (io.vertx.core.json.JsonObject)22 TestContext (io.vertx.ext.unit.TestContext)20 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)19 IOException (java.io.IOException)19 RunWith (org.junit.runner.RunWith)19 MappingParameters (org.folio.processing.mapping.defaultmapper.processor.parameters.MappingParameters)16 WireMock.stubFor (com.github.tomakehurst.wiremock.client.WireMock.stubFor)15 URISyntaxException (java.net.URISyntaxException)15 STUB_TENANT (org.folio.test.util.TestUtil.STUB_TENANT)14 After (org.junit.After)14 WireMock.post (com.github.tomakehurst.wiremock.client.WireMock.post)13 HashMap (java.util.HashMap)13