Class SimpleRequestExpectationManager
- java.lang.Object
- org.springframework.test.web.client.AbstractRequestExpectationManager
- org.springframework.test.web.client.SimpleRequestExpectationManager
- All Implemented Interfaces:
RequestExpectationManager
public class SimpleRequestExpectationManager extends AbstractRequestExpectationManager
SimpleRequestExpectationManager
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.
- Since:
- 4.3
- Author:
- Rossen Stoyanchev, Juergen Hoeller
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.test.web.client.AbstractRequestExpectationManager
AbstractRequestExpectationManager.RequestExpectationGroup
Constructor Summary
Constructors Constructor Description SimpleRequestExpectationManager()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterExpectationsDeclared()
Invoked at the time of the first actual request, which effectively means the expectations declaration phase is over.void
reset()
Reset the internal state removing all expectations and recorded requests.ClientHttpResponse
validateRequestInternal(ClientHttpRequest request)
Subclasses must implement the actual validation of the request matching to declared expectations.Methods inherited from class org.springframework.test.web.client.AbstractRequestExpectationManager
createUnexpectedRequestError, expectRequest, getExpectations, getRequestDetails, getRequests, validateRequest, verify
Constructor Detail
SimpleRequestExpectationManager
public SimpleRequestExpectationManager()
Method Detail
afterExpectationsDeclared
protected void afterExpectationsDeclared()
Description copied from class:AbstractRequestExpectationManager
Invoked at the time of the first actual request, which effectively means the expectations declaration phase is over.- Overrides:
afterExpectationsDeclared
in classAbstractRequestExpectationManager
validateRequestInternal
public ClientHttpResponse validateRequestInternal(ClientHttpRequest request) throws IOException
Description copied from class:AbstractRequestExpectationManager
Subclasses must implement the actual validation of the request matching to declared expectations.- Specified by:
validateRequestInternal
in classAbstractRequestExpectationManager
- Throws:
IOException
reset
public void reset()
Description copied from interface:RequestExpectationManager
Reset the internal state removing all expectations and recorded requests.This is a delegate for
MockRestServiceServer.reset()
.- Specified by:
reset
in interfaceRequestExpectationManager
- Overrides:
reset
in classAbstractRequestExpectationManager
- See Also:
MockRestServiceServer.reset()