Java 类android.support.test.espresso.EspressoException 实例源码

项目:simplDb    文件:MainActivityTest.java   
@Test
public void randomNameNotDisplayed() throws Exception {
    try {
        assertNameDisplayed(ExamplDb.class.getSimpleName());
        fail();
    } catch (Exception e) {
        assertThat(e, instanceOf(EspressoException.class));
    }
}
项目: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);
    }
}