public interface Responder
This 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 to
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.
request- an incoming request this responder generates a stub response for
Copyright © 2016. All Rights Reserved.