private void overFlowItemsCheck(
     int firstActivityName, int secondActivityName, int thirdActivityName) {
   openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getTargetContext());
   onView(withText(firstActivityName)).check(ViewAssertions.matches(isDisplayed()));
   onView(withText(secondActivityName)).check(ViewAssertions.matches(isDisplayed()));
   onView(withText(thirdActivityName)).check(ViewAssertions.matches(isDisplayed()));
 }
  @Test
  public void testDeleteFavorites() {

    onView(withId(R.id.favoriteButton)).perform(click());

    onView(withId(R.id.favoritesListView)).check(ViewAssertions.matches(isDisplayed()));

    for (int i = 0; i < 5; i++) {

      onData(hasToString(startsWith("")))
          .inAdapterView(withId(R.id.favoritesListView))
          .atPosition(i)
          .perform(longClick());
      onView(withId(android.R.id.button1)).perform(click());
    }
  }
  private void checkView(
      int mainScreenButton,
      int titleTextView,
      int mainTextView,
      int favButton,
      int showNextButton) {
    onView(withId(mainScreenButton)).perform(click());

    onView(withId(R.id.action_bar)).check(ViewAssertions.matches(isDisplayed()));
    onView(withId(R.id.action_home)).check(ViewAssertions.matches(isDisplayed()));
    onView(withId(R.id.action_favorites)).check(ViewAssertions.matches(isDisplayed()));

    onView(withId(titleTextView)).check(ViewAssertions.matches(isDisplayed()));
    onView(withId(mainTextView)).check(ViewAssertions.matches(isDisplayed()));
    onView(withId(favButton)).check(ViewAssertions.matches(isDisplayed()));
    onView(withId(showNextButton)).check(ViewAssertions.matches(isDisplayed()));
  }
 @Test
 public void testMapExists() {
   onView(ViewMatchers.withId(R.id.map)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
 }