Interface Responder

    • Method Detail

      • nextResponse

        StubResponse nextResponse​(Request request)

        Generates dynamically a stub response for an http request fitting the WHEN part.

        This method could be called multiple times (when more than one request fitting the WHEN arrives to the stub server). It's up to the implementation whether it returns the same stub response every time or generates it dynamically.

        When implementing this interface please keep in mind the access to the instance is not synchronized. If the tested code works in a parallel way (so this method could be called at the same time from more than just one thread), make the class either immutable or synchronize the access to all shared inner states.

        Parameters:
        request - an incoming request this responder generates a stub response for
        Returns:
        next stub response for the http request fitting the WHEN part
        See Also:
        RequestStubbing.respondUsing(net.jadler.stubbing.Responder)