@Test
    public void autoCompleteTextView_onDataClickAndCheck() {
        // NB: The autocompletion box is implemented with a ListView, so the preferred way
        // to interact with it is onData(). We can use inRoot here too!
        onView(withId(R.id.auto_complete_text_view))
                .perform(typeText("S"), closeSoftKeyboard());

        // This is useful because some of the completions may not be part of the View Hierarchy
        // unless you scroll around the list.
        onData(allOf(instanceOf(String.class), is("Baltic Sea")))
                .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))
                .perform(click());

        // The text should be filled in.
        onView(withId(R.id.auto_complete_text_view))
                .check(matches(withText("Baltic Sea")));
    }
A JUnit {@link Rule @Rule} to launch your activity under test. This is a replacement
for {@link android.test.ActivityInstrumentationTestCase2}.
<p>
Rules are interceptors which are executed for each test method and will run before
any of your setup code in the {@link Before @Before} method.
<p>
{@link ActivityTestRule} will create and launch of the activity for you and also expose
the activity under test. To get a reference to the activity you can use
the {@link ActivityTestRule#getActivity()} method.
ui/espresso/MultiWindowSample/app/src/androidTest/java/com/example/android/testing/espresso/MultiWindowSample/MultiWindowTest.java