@Test
  public void testOptionsMenuHowItWorksOnboardingCompleted() {
    setOnboardingCompletedPreference(
        InstrumentationRegistry.getInstrumentation().getTargetContext(), true);

    activityTestRule.launchActivity(null);

    onView(isRoot()).perform(pressMenuKey());
    onView(
            withText(
                InstrumentationRegistry
                    .getInstrumentation()
                    .getTargetContext()
                    .getString(R.string.how_it_works_menu_item)))
        .perform(click());

    Intent expectedIntent = new Intent(activityTestRule.getActivity(), HowItWorksActivity.class);
    intended(
        allOf(
            hasComponent(equalTo(expectedIntent.getComponent())),
            hasExtras(
                allOf(
                    hasEntry(
                        equalTo(HowItWorksActivity.KEY_FIRST_ONBOARDING_EXPERIENCE),
                        equalTo(false))))));
  }
Unit tests for {@link AuthenticatorActivity} (part/shard 1).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityTest.java