Invokes the given handler with a newly created {@link ratpack.handling.Context} based on the state of this fixture.
The return value can be used to examine the effective result of the handler.
A result may be one of the following:
- The sending of a response via one of the {@link ratpack.http.Response#send} methods
- Rendering to the response via the {@link ratpack.handling.Context#render(Object)}
- Raising of a client error via {@link ratpack.handling.Context#clientError(int)}
- Raising of a server error via {@link ratpack.handling.Context#error(Throwable)}
- Raising of a server error by the throwing of an exception
- Delegating to the next handler by invoking one of the {@link ratpack.handling.Context#next} methods
Note that any handlers
{@link ratpack.handling.Context#insert inserted} by the handler under test will be invoked. If the last inserted handler delegates to the next handler, the handling will terminate with a result indicating that the effective result was delegating to the next handler.
This method blocks until a result is achieved, even if the handler performs an asynchronous operation (such as performing {@link ratpack.handling.Context#blocking(java.util.concurrent.Callable) blocking IO}). As such, a time limit on the execution is imposed which by default is 5 seconds. The time limit can be changed via the {@link #timeout(int)} method.If the time limit is reached, a {@link HandlerTimeoutException} is thrown.
@param handler the handler to test
@return the effective result of the handling
@throws HandlerTimeoutException if the handler does not produce a result in the time limit defined by this fixture