use of com.github.tomakehurst.wiremock.matching.StringValuePattern in project spring-cloud-contract by spring-cloud.
the class WireMockRequestStubStrategy method appendQueryParameters.
private void appendQueryParameters(RequestPatternBuilder requestPattern) {
QueryParameters queryParameters = Optional.ofNullable(request).map(Request::getUrlPath).map(Url::getQueryParameters).orElseGet(() -> Optional.ofNullable(request).map(Request::getUrl).map(Url::getQueryParameters).orElse(null));
Optional.ofNullable(queryParameters).map(QueryParameters::getParameters).ifPresent(parameters -> parameters.forEach(parameter -> requestPattern.withQueryParam(parameter.getName(), (StringValuePattern) convertToValuePattern(parameter.getClientValue()))));
}
use of com.github.tomakehurst.wiremock.matching.StringValuePattern in project mod-kb-ebsco-java by folio-org.
the class TransactionLoadHoldingsImplTest method mockPostDeltaReport.
private void mockPostDeltaReport() {
StringValuePattern urlPattern = new EqualToPattern(RMAPI_DELTAS_URL);
stubFor(post(new UrlPathPattern(urlPattern, false)).willReturn(new ResponseDefinitionBuilder().withBody(DELTA_ID).withStatus(202)));
}
use of com.github.tomakehurst.wiremock.matching.StringValuePattern in project mod-kb-ebsco-java by folio-org.
the class TransactionLoadHoldingsImplTest method mockPostHoldings.
private void mockPostHoldings() {
StringValuePattern urlPattern = new EqualToPattern(RMAPI_POST_TRANSACTIONS_HOLDINGS_URL);
stubFor(post(new UrlPathPattern(urlPattern, false)).willReturn(new ResponseDefinitionBuilder().withBody(Json.encode(createTransactionId())).withStatus(202)));
}
use of com.github.tomakehurst.wiremock.matching.StringValuePattern in project wiremock by wiremock.
the class RemoveServeEventsByStubMetadataTask method execute.
@Override
public ResponseDefinition execute(Admin admin, Request request, PathParams pathParams) {
StringValuePattern metadataPattern = Json.read(request.getBodyAsString(), StringValuePattern.class);
FindServeEventsResult findServeEventsResult = admin.removeServeEventsForStubsMatchingMetadata(metadataPattern);
return ResponseDefinition.okForJson(findServeEventsResult);
}
use of com.github.tomakehurst.wiremock.matching.StringValuePattern in project sechub by mercedes-benz.
the class JSONAdapterSupportTest method buildFromMap_json_with_one_entry_returns_map_with_this_entry.
@Test
public void buildFromMap_json_with_one_entry_returns_map_with_this_entry() throws Exception {
/* prepare */
Map<String, Object> json = new TreeMap<>();
json.put("key1", "value1");
/* execute */
String jsonAsString = supportToTest.toJSON(json);
/* test */
assertNotNull(jsonAsString);
StringValuePattern p = WireMock.equalToJson("{\"key1\":\"value1\"}");
assertTrue(p.match(jsonAsString).isExactMatch());
}
Aggregations