Java 类android.support.test.espresso.core.deps.guava.base.Throwables 实例源码

项目:adyen-android    文件:EspressoTestUtils.java   
private static <X> X callOnMainSync(Instrumentation instrumentation, final Callable<X> callable)
        throws Exception {
    final AtomicReference<X> retAtomic = new AtomicReference<>();
    final AtomicReference<Throwable> exceptionAtomic = new AtomicReference<>();
    instrumentation.runOnMainSync(new Runnable() {
        @Override
        public void run() {
            try {
                retAtomic.set(callable.call());
            } catch (Throwable e) {
                exceptionAtomic.set(e);
            }
        }
    });
    final Throwable exception = exceptionAtomic.get();
    if (exception != null) {
        Throwables.propagateIfInstanceOf(exception, Exception.class);
        Throwables.propagate(exception);
    }
    return retAtomic.get();
}
项目:2016.2-WikiLegis    文件:RegisterUserFragmentTest.java   
public static <X> X callOnMainSync(Instrumentation instrumentation, final Callable<X> callable) throws Exception {
    final AtomicReference<X> retAtomic = new AtomicReference<>();
    final AtomicReference<Throwable> exceptionAtomic = new AtomicReference<>();
    instrumentation.runOnMainSync(new Runnable() {
        @Override
        public void run() {
            try {
                retAtomic.set(callable.call());
            } catch (Throwable e) {
                exceptionAtomic.set(e);
            }
        }
    });
    final Throwable exception = exceptionAtomic.get();
    if (exception != null) {
        Throwables.propagateIfInstanceOf(exception, Exception.class);
        Throwables.propagate(exception);
    }
    return retAtomic.get();
}
项目:2016.2-WikiLegis    文件:OpenBillListFragmentTest.java   
public static <X> X callOnMainSync(Instrumentation instrumentation, final Callable<X> callable) throws Exception {
    final AtomicReference<X> retAtomic = new AtomicReference<>();
    final AtomicReference<Throwable> exceptionAtomic = new AtomicReference<>();
    instrumentation.runOnMainSync(new Runnable() {
        @Override
        public void run() {
            try {
                retAtomic.set(callable.call());
            } catch (Throwable e) {
                exceptionAtomic.set(e);
            }
        }
    });
    final Throwable exception = exceptionAtomic.get();
    if (exception != null) {
        Throwables.propagateIfInstanceOf(exception, Exception.class);
        Throwables.propagate(exception);
    }
    return retAtomic.get();
}
项目:Espresso-CustomFailureHandler    文件:ScreenShotFailureHandler.java   
@Override
public void handle(Throwable error, Matcher<View> viewMatcher) {
    if (error instanceof EspressoException || error instanceof AssertionFailedError
            || error instanceof AssertionError) {
        Uri location = Uri.EMPTY;
        if (activityRef.get() != null) {
            location = screenShotManager.shoot(activityRef.get().getWindow().getDecorView());
        }
        throw Throwables.propagate(getUserFriendlyError(error, viewMatcher, location.toString()));
    } else {
        throw Throwables.propagate(error);
    }
}