SystemMaintenanceExceptionMapper implements ExceptionMapper<SystemMaintenanceException> { public Response toResponse(final SystemMaintenanceException e) { return ErrorResponseBuilder .from(e) .addHeader(HttpHeaders.RETRY_AFTER, "60") .build(); }  Response toResponse(final SystemMaintenanceException e);  }
@Test public void testToResponse() { SystemMaintenanceExceptionMapper mapper = new SystemMaintenanceExceptionMapper(); SystemMaintenanceException jpe = new SystemMaintenanceException(); Response r = mapper.toResponse(jpe); ErrorResponse er = (ErrorResponse) r.getEntity(); assertEquals(Status.SERVICE_UNAVAILABLE.getStatusCode(), r.getStatus()); assertEquals(Status.SERVICE_UNAVAILABLE, er.getHttpStatus()); assertEquals(SystemMaintenanceException.CODE.getError(), er.getError()); assertEquals(SystemMaintenanceException.CODE.getErrorDescription(), er.getErrorDescription()); }