@Override
  public Response toResponse(Throwable t) {
    int status = DEFAULT_STATUS;
    if (t instanceof WebApplicationException) {
      status = ((WebApplicationException) t).getResponse().getStatus();
    }
    SimpleHttpErrorInfo errorInfo = new SimpleHttpErrorInfo(status, t.getMessage());
    return Response.status(status).entity(errorInfo).type(MediaType.APPLICATION_JSON).build();
  }
@Test
  public void testToResponseWithWebApplicationException() {
    // Arrange
    int status = 404;
    when(_webApplicationException.getResponse()).thenReturn(Response.status(status).build());
    when(_webApplicationException.getMessage()).thenReturn("Not Found");

    // Act
    Response response = _exceptionMapper.toResponse(_webApplicationException);

    // Assert
    assertEquals(response.getStatus(), status);
    SimpleHttpErrorInfo errorInfo = (SimpleHttpErrorInfo) response.getEntity();
    assertEquals(errorInfo.getCode(), status);
    assertEquals(errorInfo.getError(), "Not Found");
  }