Package com.mx.path.testing.request
Class RequestExpectations
java.lang.Object
com.mx.path.testing.request.RequestExpectations
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddRequest(com.mx.path.core.common.connect.Request<?, ?> request) Capture and store a handled request.static RequestExpectationallowConnection(RequestMatcher requestMatcher) Alias tostubConnection(RequestMatcher)static RequestExpectationexpectConnection(RequestMatcher requestMatcher) Create a request expectation.static List<RequestExpectation>static List<RequestExpectation>static com.mx.path.core.common.connect.Request<?,?> request()Get the first request executed against expectations.static com.mx.path.core.common.connect.Request<?,?> request(RequestMatcher requestMatcher) Get the first matching request executed against expectations.static List<com.mx.path.core.common.connect.Request<?,?>> requests()Get the requests received by expectations (does not include allowances).static List<com.mx.path.core.common.connect.Request<?,?>> requests(RequestMatcher requestMatcher) Get the filtered requests received by expectations (does not include allowances).static voidreset()Clears out expectations.static RequestExpectationstubConnection(RequestMatcher requestMatcher) Creates a request expectation that is not expected to be invokedstatic booleanVerifies that all expected requests were made.
-
Constructor Details
-
RequestExpectations
public RequestExpectations()
-
-
Method Details
-
getRequestAllowances
-
getRequestExpectations
-
addRequest
public static void addRequest(com.mx.path.core.common.connect.Request<?, ?> request) Capture and store a handled request. This is called every time a request is matched and handled by any expectation- Parameters:
request- received request
-
allowConnection
Alias tostubConnection(RequestMatcher) -
expectConnection
Create a request expectation. Will fail verification if not invoked.- Parameters:
requestMatcher- matching rules- Returns:
- self
-
request
public static com.mx.path.core.common.connect.Request<?,?> request()Get the first request executed against expectations.- Returns:
- first request
-
request
Get the first matching request executed against expectations.- Parameters:
requestMatcher- matching rules- Returns:
- first request
-
requests
Get the requests received by expectations (does not include allowances). Requests are in the order they were received.- Returns:
- list of requests
-
requests
public static List<com.mx.path.core.common.connect.Request<?,?>> requests(RequestMatcher requestMatcher) Get the filtered requests received by expectations (does not include allowances). Requests are in the order they were received.- Returns:
- list of requests
-
reset
public static void reset()Clears out expectations. Should be invoked between tests. -
stubConnection
Creates a request expectation that is not expected to be invoked- Parameters:
requestMatcher-- Returns:
- new expectation
-
verifyConnectionExpectations
public static boolean verifyConnectionExpectations()Verifies that all expected requests were made. Raises exception if expectations are not met.- Returns:
- true if all requests were made. (this return value allows this to be invoked in
then:section of Spock test.)
-