Package net.jadler
Interface RequestManager
-
- All Known Implementing Classes:
JadlerMocker
public interface RequestManagerA stateful component which provides stub responses for given requests. These requests are recorded so further mocking (verifying) is possible.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidevaluateVerification(Collection<org.hamcrest.Matcher<? super Request>> requestPredicates, org.hamcrest.Matcher<Integer> nrRequestsPredicate)Verifies whether the number of received http requests fitting the given predicates is as expected.intnumberOfRequestsMatching(Collection<org.hamcrest.Matcher<? super Request>> predicates)Deprecated.this (rather internal) method has been deprecated.StubResponseprovideStubResponseFor(Request req)Returns a stub response for the given request.
-
-
-
Method Detail
-
provideStubResponseFor
StubResponse provideStubResponseFor(Request req)
Returns a stub response for the given request. The request is recorded for further mocking (verifying).- Parameters:
req- http request to return a stub response for- Returns:
- definition of a stub response to be returned by the stub http server (never returns
null)
-
evaluateVerification
void evaluateVerification(Collection<org.hamcrest.Matcher<? super Request>> requestPredicates, org.hamcrest.Matcher<Integer> nrRequestsPredicate)
Verifies whether the number of received http requests fitting the given predicates is as expected. Basically at first this operation computes the exact number of http requests received so far fitting the given predicates and then verifies whether the number is as expected. If not aVerificationExceptionis thrown and the exact reason is logged on theINFOlevel.- Parameters:
requestPredicates- predicates about the http requests received so far (cannot benull, can be empty however)nrRequestsPredicate- a predicate about the number of http requests received so far which fit the given request predicates (cannot benull)- Throws:
VerificationException- if the verification fails
-
numberOfRequestsMatching
@Deprecated int numberOfRequestsMatching(Collection<org.hamcrest.Matcher<? super Request>> predicates)
Deprecated.this (rather internal) method has been deprecated. Please useevaluateVerification(java.util.Collection, org.hamcrest.Matcher)instead- Parameters:
predicates- predicates to be applied on all incoming http requests- Returns:
- number of requests recorded by
provideStubResponseFor(net.jadler.Request)matching the given matchers
-
-