public class SimpleRequestExpectationManager extends AbstractRequestExpectationManager
RequestExpectationManager
that matches requests to expectations
sequentially, i.e. in the order of declaration of expectations.
When request expectations have an expected count greater than one, only the first execution is expected to match the order of declaration. Subsequent request executions may be inserted anywhere thereafter.
AbstractRequestExpectationManager.RequestExpectationGroup
Modifier and Type | Field and Description |
---|---|
private java.util.Iterator<RequestExpectation> |
expectationIterator
Expectations in the order of declaration (count may be > 1).
|
private AbstractRequestExpectationManager.RequestExpectationGroup |
repeatExpectations
Track expectations that have a remaining count.
|
Constructor and Description |
---|
SimpleRequestExpectationManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterExpectationsDeclared()
Invoked at the time of the first actual request, which effectively means
the expectations declaration phase is over.
|
protected RequestExpectation |
matchRequest(ClientHttpRequest request)
As of 5.0.3 subclasses should implement this method instead of
AbstractRequestExpectationManager.validateRequestInternal(ClientHttpRequest) in order to match the
request to an expectation, leaving the call to create the response as a separate step
(to be invoked by this class). |
void |
reset()
Reset the internal state removing all expectations and recorded requests.
|
createUnexpectedRequestError, expectRequest, getExpectations, getRequestDetails, getRequests, validateRequest, validateRequestInternal, verify
@Nullable private java.util.Iterator<RequestExpectation> expectationIterator
private final AbstractRequestExpectationManager.RequestExpectationGroup repeatExpectations
protected void afterExpectationsDeclared()
AbstractRequestExpectationManager
afterExpectationsDeclared
in class AbstractRequestExpectationManager
protected RequestExpectation matchRequest(ClientHttpRequest request) throws java.io.IOException
AbstractRequestExpectationManager
AbstractRequestExpectationManager.validateRequestInternal(ClientHttpRequest)
in order to match the
request to an expectation, leaving the call to create the response as a separate step
(to be invoked by this class).matchRequest
in class AbstractRequestExpectationManager
request
- the current requestRequestExpectation.incrementAndValidate()
.java.io.IOException
public void reset()
RequestExpectationManager
This is a delegate for MockRestServiceServer.reset()
.
reset
in interface RequestExpectationManager
reset
in class AbstractRequestExpectationManager
MockRestServiceServer.reset()