public static T invoke()

in hugegraph-common/src/main/java/org/apache/hugegraph/testutil/Whitebox.java [143:164]


    public static <T> T invoke(Class<?> clazz, Class<?>[] classes,
                               String methodName, Object self, Object... args) {
        Method method = method(clazz, methodName, classes);
        try {
            method.setAccessible(true);
            @SuppressWarnings("unchecked")
            T result = (T) method.invoke(self, args);
            return result;
        } catch (IllegalAccessException e) {
            throw new RuntimeException(String.format(
                      "Can't invoke method '%s' of class '%s': %s",
                      methodName, clazz, e.getMessage()), e);
        } catch (InvocationTargetException e) {
            Throwable target = e.getTargetException();
            if (target instanceof RuntimeException) {
                throw (RuntimeException) target;
            }
            throw new RuntimeException(String.format(
                      "Can't invoke method '%s' of class '%s': %s",
                      methodName, clazz, target.getMessage()), target);
        }
    }