Package net.jadler

Interface RequestManager

  • All Known Implementing Classes:
    JadlerMocker

    public interface RequestManager
    A stateful component which provides stub responses for given requests. These requests are recorded so further mocking (verifying) is possible.
    • 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 a VerificationException is thrown and the exact reason is logged on the INFO level.
        Parameters:
        requestPredicates - predicates about the http requests received so far (cannot be null, can be empty however)
        nrRequestsPredicate - a predicate about the number of http requests received so far which fit the given request predicates (cannot be null)
        Throws:
        VerificationException - if the verification fails