class RequestMatcherClientHttpRequest extends MockClientHttpRequest implements ResponseActions
MockClientHttpRequest
that matches the request
against a set of expectations, via RequestMatcher
instances. The
expectations are checked when the request is executed. This class also uses a
ResponseCreator
to create the response.Modifier and Type | Field and Description |
---|---|
private java.util.List<RequestMatcher> |
requestMatchers |
private ResponseCreator |
responseCreator |
Constructor and Description |
---|
RequestMatcherClientHttpRequest(RequestMatcher requestMatcher) |
Modifier and Type | Method and Description |
---|---|
ResponseActions |
andExpect(RequestMatcher requestMatcher)
Add a request expectation.
|
void |
andRespond(ResponseCreator responseCreator)
Define the response.
|
ClientHttpResponse |
execute()
|
getMethod, getURI, isExecuted, setMethod, setResponse, setURI, toString
getBody, getBodyAsBytes, getBodyAsString, getBodyAsString, getHeaders
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBody
getHeaders
private final java.util.List<RequestMatcher> requestMatchers
private ResponseCreator responseCreator
public RequestMatcherClientHttpRequest(RequestMatcher requestMatcher)
public ResponseActions andExpect(RequestMatcher requestMatcher)
ResponseActions
andExpect
in interface ResponseActions
public void andRespond(ResponseCreator responseCreator)
ResponseActions
andRespond
in interface ResponseActions
responseCreator
- the creator of the responsepublic ClientHttpResponse execute() throws java.io.IOException
MockClientHttpRequest
execute
in interface ClientHttpRequest
execute
in class MockClientHttpRequest
java.io.IOException
- in case of I/O errors