Package | Description |
---|---|
org.mockserver.client.server |
Modifier and Type | Method and Description |
---|---|
ForwardChainExpectation |
MockServerClient.when(HttpRequest httpRequest)
Specify an unlimited expectation that will respond regardless of the number of matching http
for example:
mockServerClient
.when(
request()
.withPath("/some_path")
.withBody("some_request_body")
)
.respond(
response()
.withBody("some_response_body")
.withHeaders(
new Header("responseName", "responseValue")
)
);
|
ForwardChainExpectation |
MockServerClient.when(HttpRequest httpRequest,
Times times)
Specify an limited expectation that will respond a specified number of times when the http is matched
for example:
mockServerClient
.when(
new HttpRequest()
.withPath("/some_path")
.withBody("some_request_body"),
Times.exactly(5)
)
.respond(
new HttpResponse()
.withBody("some_response_body")
.withHeaders(
new Header("responseName", "responseValue")
)
);
|
ForwardChainExpectation |
MockServerClient.when(HttpRequest httpRequest,
Times times,
TimeToLive timeToLive)
Specify an limited expectation that will respond a specified number of times when the http is matched
for example:
mockServerClient
.when(
new HttpRequest()
.withPath("/some_path")
.withBody("some_request_body"),
Times.exactly(5),
TimeToLive.exactly(TimeUnit.SECONDS, 120),
)
.respond(
new HttpResponse()
.withBody("some_response_body")
.withHeaders(
new Header("responseName", "responseValue")
)
);
|
Copyright © 2018. All rights reserved.