private void checkBadAccountSetup(String uri, int dialogId) {
    activityTestRule.launchActivity(null);

    callOnActivityResultOnUiThreadWithScannedUri(uri);

    assertThat(mAccountDb.getAccounts()).isEmpty();
    TestUtilities.assertDialogWasDisplayed(activityTestRule.getActivity(), dialogId);
    // AuthenticatorActivity should continue
    assertThat(activityTestRule.getActivity().isFinishing()).isFalse();
  }
Unit test for authenticator activity (part/shard 2).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityPart2Test.java