Interface Responder
-
public interface ResponderThis interface provides a way to define a stub response in a dynamic way (instead of the static approach triggered by the
RequestStubbing.respond()method). Usually it's implemented as an anonymous inner class provided as an argument toRequestStubbing.respondUsing(net.jadler.stubbing.Responder).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StubResponsenextResponse(Request request)Generates dynamically a stub response for an http request fitting the WHEN part.
-
-
-
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)
-
-