ResourceException extends RuntimeException { public ResourceException(int code, Object data) { this(code, data.toString()); } ResourceException(int code, Object data);  ResourceException(int code, String message); int getCode(); final static int OK; final static int FORBIDDEN; final static int NOT_FOUND; final static int GATEWAY_TIMEOUT; }
@Test public void testResourceException() { ResourceException exc = new ResourceException(400, "Bad Request"); assertEquals(exc.getMessage(), "ResourceException (400): Bad Request"); assertEquals(exc.getCode(), 400); ResourceException excObj = new ResourceException(403, (Object) "Object String"); assertEquals(excObj.getMessage(), "ResourceException (403): Object String"); assertEquals(excObj.getCode(), 403); }