ResourceException extends RuntimeException { public ResourceException(int code) { this(code, symbolForCode(code)); } ResourceException(int code);  ResourceException(int code, Object data); static int codeForSymbol(String sym); static String symbolForCode(int code); int getCode(); Object getData(); T getData(Class<T> cl); final static int OK; final static int CREATED; final static int ACCEPTED; final static int NO_CONTENT; final static int MOVED_PERMANENTLY; final static int FOUND; final static int SEE_OTHER; final static int NOT_MODIFIED; final static int TEMPORARY_REDIRECT; final static int BAD_REQUEST; final static int UNAUTHORIZED; final static int FORBIDDEN; final static int NOT_FOUND; final static int CONFLICT; final static int GONE; final static int PRECONDITION_FAILED; final static int UNSUPPORTED_MEDIA_TYPE; final static int INTERNAL_SERVER_ERROR; final static int NOT_IMPLEMENTED; final static int SERVICE_UNAVAILABLE; }
@Test public void testResourceException() { ResourceException exception = new ResourceException(200); assertEquals(exception.getCode(), 200); assertEquals(exception.getData(), "OK"); assertEquals(exception.getData(String.class), "OK"); }