本文整理了Java中com.github.tomakehurst.wiremock.client.WireMock.matching()
方法的一些代码示例,展示了WireMock.matching()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WireMock.matching()
方法的具体详情如下:
包路径:com.github.tomakehurst.wiremock.client.WireMock
类名称:WireMock
方法名:matching
暂无
代码示例来源:origin: com.github.tomakehurst/wiremock-jre8
public static UrlPattern urlMatching(String urlRegex) {
return new UrlPattern(matching(urlRegex), true);
}
代码示例来源:origin: com.github.tomakehurst/wiremock-jre8
public static UrlPathPattern urlPathMatching(String urlRegex) {
return new UrlPathPattern(matching(urlRegex), true);
}
代码示例来源:origin: DiUS/pact-workshop-jvm
@Test
public void canProcessTheJsonPayloadFromTheProvider() throws UnirestException {
String date = "2013-08-16T15:31:20+10:00";
stubFor(get(urlPathEqualTo("/provider.json"))
.withQueryParam("validDate", matching(".+"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody("{\"test\": \"NO\", \"validDate\": \"" + date + "\", \"count\": 100}")));
List<Object> data = new Client("http://localhost:8089").fetchAndProcessData(LocalDateTime.now().toString());
assertThat(data, hasSize(2));
assertThat(data.get(0), is(1));
assertThat(data.get(1), is(equalTo(OffsetDateTime.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")))));
}
代码示例来源:origin: cyclestreets/android
@Test
public void testUploadPhotoReturnsOk() throws Exception {
// given
stubFor(post(urlPathEqualTo("/v2/photomap.add"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBodyFile("upload-ok.json")));
// when
Upload.Result result = apiClient.uploadPhoto("arnold", "cyberdyne101", -0.5, 53, 12345678,
"scifi", "evilrobots", "The Cyberdyne Model 101",
null);
// then
verify(postRequestedFor(urlPathEqualTo("/v2/photomap.add"))
.withHeader("Content-Type", matching("multipart/form-data; boundary=.*"))
.withRequestBody(matching(".*username.*arnold.*password.*cyberdyne101.*longitude.*-0.5.*latitude.*53.*datetime.*12345678.*category.*scifi.*metacategory.*evilrobots.*caption.*The Cyberdyne Model 101.*"))
.withQueryParam("key", equalTo("myApiKey")));
assertThat(result.ok(), is(true));
assertThat(result.url(), is("https://www.cyclestreets.net/location/64001/"));
}
代码示例来源:origin: cyclestreets/android
@Test
public void testSendFeedbackReturnsOk() throws Exception {
// given
stubFor(post(urlPathEqualTo("/v2/feedback.add"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBodyFile("feedback-ok.json")));
// when
Result result = apiClient.sendFeedback(1234, "Comments I want to make", "My Name", "ballboy@wimbledon.com");
// then
verify(postRequestedFor(urlPathEqualTo("/v2/feedback.add"))
.withHeader("Content-Type", equalTo("application/x-www-form-urlencoded"))
.withRequestBody(matching("type=routing&itinerary=1234&comments=Comments%20I%20want%20to%20make&name=My%20Name&email=ballboy%40wimbledon.com"))
.withQueryParam("key", equalTo("myApiKey")));
assertThat(result.ok(), is(true));
assertThat(result.message(), containsString("Thank you for submitting this feedback"));
}
代码示例来源:origin: bijukunjummen/boot2-load-demo
.withRequestBody(matching(".*sample.*"))
);
代码示例来源:origin: bijukunjummen/boot2-load-demo
.withRequestBody(matching(".*sample.*"))
);
内容来源于网络,如有侵权,请联系作者删除!