@Test
  public void testAccountSetup_withNullIntent() {
    activityTestRule.launchActivity(null);

    TestUtilities.invokeOnActivityResultOnUiThread(
        activityTestRule.getActivity(),
        AuthenticatorActivity.SCAN_REQUEST, Activity.RESULT_OK, null);

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