@Test
    public void testChangingPages() throws Throwable {
        final ViewPager pager = activityTestRule.getActivity().findViewById(id.vp_pages);

        assertEquals(0, pager.getCurrentItem());
        activityTestRule.runOnUiThread(() -> pager.setCurrentItem(1, true));
        assertEquals(1, pager.getCurrentItem());
        activityTestRule.runOnUiThread(() -> pager.setCurrentItem(0, true));
        assertEquals(0, pager.getCurrentItem());
    }
Verify changing pages between gist files

@throws Throwable
app/src/androidTest/java/com/github/pockethub/android/tests/gist/GistFilesViewActivityTest.java