private static Response getResponse(Throwable t) {
        if (t instanceof WebApplicationException e) {
            return e.getResponse();
        } else {
            return Response
                .status(Status.INTERNAL_SERVER_ERROR.getStatusCode(), t.getMessage())
                .entity(new ErrorData(getExceptionData(t)))
                .type(MediaType.APPLICATION_JSON)
                .build();
        }
    }
@Test
    public void testWebApplicationException() {
        WebApplicationException wae = new WebApplicationException("test web application exception", Status.TEMPORARY_REDIRECT);
        RestException testException = new RestException(wae);

        assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(), testException.getResponse().getStatus());
        assertEquals(wae.getResponse().getEntity(), testException.getResponse().getEntity());
    }