Search in sources :

Example 1 with RESTCodes

use of io.hops.hopsworks.restutils.RESTCodes in project hopsworks by logicalclocks.

the class TestRESTCodes method getRESTErrorCodes.

@Before
public void getRESTErrorCodes() {
    RESTCodes restCodes = new RESTCodes();
    Class<?>[] classes = restCodes.getClass().getClasses();
    Method method;
    for (Class enumClass : classes) {
        try {
            method = enumClass.getMethod("values");
            RESTErrorCode[] obj = (RESTErrorCode[]) method.invoke(null);
            values.put(enumClass.getName(), Arrays.asList(obj));
            ranges.put(enumClass.getName(), obj[0].getRange());
        } catch (ClassCastException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
        }
    }
}
Also used : RESTErrorCode(io.hops.hopsworks.restutils.RESTCodes.RESTErrorCode) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) RESTCodes(io.hops.hopsworks.restutils.RESTCodes) Before(org.junit.Before)

Aggregations

RESTCodes (io.hops.hopsworks.restutils.RESTCodes)1 RESTErrorCode (io.hops.hopsworks.restutils.RESTCodes.RESTErrorCode)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Before (org.junit.Before)1