public class DefaultRequestExpectation extends Object implements RequestExpectation
RequestExpectation that simply delegates
to the request matchers and the response creator it contains.| Modifier and Type | Class and Description |
|---|---|
protected static class |
DefaultRequestExpectation.RequestCount
Helper class that keeps track of actual vs expected request count.
|
| Constructor and Description |
|---|
DefaultRequestExpectation(ExpectedCount expectedCount,
RequestMatcher requestMatcher)
Create a new request expectation that should be called a number of times
as indicated by
RequestCount. |
| Modifier and Type | Method and Description |
|---|---|
ResponseActions |
andExpect(RequestMatcher requestMatcher)
Add a request expectation.
|
void |
andRespond(ResponseCreator responseCreator)
Define the response.
|
ClientHttpResponse |
createResponse(ClientHttpRequest request)
Create a response for the given request.
|
protected DefaultRequestExpectation.RequestCount |
getRequestCount() |
protected List<RequestMatcher> |
getRequestMatchers() |
protected ResponseCreator |
getResponseCreator() |
boolean |
hasRemainingCount()
Whether there is a remaining count of invocations for this expectation.
|
boolean |
isSatisfied()
Whether the requirements for this request expectation have been met.
|
void |
match(ClientHttpRequest request)
Match the given request against some expectations.
|
public DefaultRequestExpectation(ExpectedCount expectedCount, RequestMatcher requestMatcher)
RequestCount.expectedCount - the expected request expectedCountprotected DefaultRequestExpectation.RequestCount getRequestCount()
protected List<RequestMatcher> getRequestMatchers()
protected ResponseCreator getResponseCreator()
public ResponseActions andExpect(RequestMatcher requestMatcher)
ResponseActionsandExpect in interface ResponseActionspublic void andRespond(ResponseCreator responseCreator)
ResponseActionsandRespond in interface ResponseActionsresponseCreator - the creator of the responsepublic void match(ClientHttpRequest request) throws IOException
RequestMatchermatch in interface RequestMatcherrequest - the request to make assertions onIOException - in case of I/O errorspublic ClientHttpResponse createResponse(ClientHttpRequest request) throws IOException
ResponseCreatorcreateResponse in interface ResponseCreatorrequest - the requestIOExceptionpublic boolean hasRemainingCount()
RequestExpectationhasRemainingCount in interface RequestExpectationpublic boolean isSatisfied()
RequestExpectationisSatisfied in interface RequestExpectation