@Test
public void usesMessageFromCauseOfWebApplicationExceptionForResponseEntityWhenResponseFromWebApplicationExceptionDoesNotHaveEntity() throws Exception {

    Exception exception = new Exception("Error message");
    WebApplicationException webApplicationException = new WebApplicationException(exception);
    doThrow(webApplicationException).when(requestDispatcher).dispatch(request, response);
    requestHandler.handleRequest(request, response);
    ArgumentCaptor<Response> argumentCaptor = ArgumentCaptor.forClass(Response.class);
    verify(response).setResponse(argumentCaptor.capture());
    assertEquals(INTERNAL_SERVER_ERROR, argumentCaptor.getValue().getStatusInfo());
    assertEquals("Error message", argumentCaptor.getValue().getEntity());
}