Search in sources :

Example 1 with UmbrellaException

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);
    }
}
Also used : ReflectionException(com.googlecode.gwt.test.exceptions.ReflectionException) UmbrellaException(com.google.web.bindery.event.shared.UmbrellaException) GwtTestException(com.googlecode.gwt.test.exceptions.GwtTestException) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) ReflectionException(com.googlecode.gwt.test.exceptions.ReflectionException) GwtTestException(com.googlecode.gwt.test.exceptions.GwtTestException) UmbrellaException(com.google.web.bindery.event.shared.UmbrellaException)

Aggregations

JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 UmbrellaException (com.google.web.bindery.event.shared.UmbrellaException)1 GwtTestException (com.googlecode.gwt.test.exceptions.GwtTestException)1 ReflectionException (com.googlecode.gwt.test.exceptions.ReflectionException)1