Search in sources :

Example 1 with ViewFinder

use of com.google.android.apps.common.testing.ui.espresso.ViewFinder in project double-espresso by JakeWharton.

the class ViewFinderImplTest method testGetView_missing.

@UiThreadTest
public void testGetView_missing() {
    ViewFinder finder = new ViewFinderImpl(Matchers.<View>nullValue(), testViewProvider);
    try {
        finder.getView();
        fail("No children should pass that matcher!");
    } catch (NoMatchingViewException expected) {
    }
}
Also used : ViewFinder(com.google.android.apps.common.testing.ui.espresso.ViewFinder) NoMatchingViewException(com.google.android.apps.common.testing.ui.espresso.NoMatchingViewException) UiThreadTest(android.test.UiThreadTest)

Example 2 with ViewFinder

use of com.google.android.apps.common.testing.ui.espresso.ViewFinder in project double-espresso by JakeWharton.

the class ViewFinderImplTest method testGetView_present.

@UiThreadTest
public void testGetView_present() {
    ViewFinder finder = new ViewFinderImpl(sameInstance(nestedChild), testViewProvider);
    assertThat(finder.getView(), sameInstance(nestedChild));
}
Also used : ViewFinder(com.google.android.apps.common.testing.ui.espresso.ViewFinder) UiThreadTest(android.test.UiThreadTest)

Example 3 with ViewFinder

use of com.google.android.apps.common.testing.ui.espresso.ViewFinder in project double-espresso by JakeWharton.

the class ViewFinderImplTest method testGetView_multiple.

@UiThreadTest
public void testGetView_multiple() {
    ViewFinder finder = new ViewFinderImpl(Matchers.<View>notNullValue(), testViewProvider);
    try {
        finder.getView();
        fail("All nodes hit that matcher!");
    } catch (AmbiguousViewMatcherException expected) {
    }
}
Also used : AmbiguousViewMatcherException(com.google.android.apps.common.testing.ui.espresso.AmbiguousViewMatcherException) ViewFinder(com.google.android.apps.common.testing.ui.espresso.ViewFinder) UiThreadTest(android.test.UiThreadTest)

Example 4 with ViewFinder

use of com.google.android.apps.common.testing.ui.espresso.ViewFinder in project double-espresso by JakeWharton.

the class ViewFinderImplTest method testFind_offUiThread.

public void testFind_offUiThread() {
    ViewFinder finder = new ViewFinderImpl(sameInstance(nestedChild), testViewProvider);
    try {
        finder.getView();
        fail("not on main thread, should die.");
    } catch (IllegalStateException expected) {
    }
}
Also used : ViewFinder(com.google.android.apps.common.testing.ui.espresso.ViewFinder)

Aggregations

ViewFinder (com.google.android.apps.common.testing.ui.espresso.ViewFinder)4 UiThreadTest (android.test.UiThreadTest)3 AmbiguousViewMatcherException (com.google.android.apps.common.testing.ui.espresso.AmbiguousViewMatcherException)1 NoMatchingViewException (com.google.android.apps.common.testing.ui.espresso.NoMatchingViewException)1