use of com.google.web.bindery.event.shared.UmbrellaException in project gwt-test-utils by gwt-test-utils.
the class GwtReflectionUtils method callPrivateMethod.
public static <T> T callPrivateMethod(Object target, Method method, Object... args) {
try {
method.setAccessible(true);
Object res = method.invoke(target, args);
return (T) res;
} catch (InvocationTargetException e) {
if (e.getCause() instanceof GwtTestException) {
throw (GwtTestException) e.getCause();
} else if (e.getCause() instanceof AssertionError) {
throw (AssertionError) e.getCause();
} else if (e.getCause() instanceof UmbrellaException) {
throw new ReflectionException("Error while calling method '" + method.toString() + "'", e.getCause().getCause());
}
throw new ReflectionException("Error while calling method '" + method.toString() + "'", e.getCause());
} catch (Exception e) {
throw new ReflectionException("Unable to call method '" + target.getClass().getSimpleName() + "." + method.getName() + "(..)'", e);
}
}
Aggregations