@Test
  public void testBeginSetupButtonWithFirstOnboarding() {
    setOnboardingCompletedPreference(
        InstrumentationRegistry.getInstrumentation().getTargetContext(), false);

    activityTestRule.launchActivity(null);

    onView(withId(R.id.add_account_button)).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(true))))));
    assertThat(TestUtilities.isStrayIntentRemaining()).isFalse();
  }
Unit tests for {@link AuthenticatorActivity} (part/shard 1).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityTest.java