@Test
  public void testAccountSetupViaReceivedIntentWithWrongAction() {
    String accountName = "test@gmail.com";
    activityTestRule.launchActivity(
        new Intent(
                InstrumentationRegistry.getInstrumentation().getTargetContext(),
                AuthenticatorActivity.class)
            .setData(Uri.parse("otpauth://totp/" + accountName + "?secret=AAAABBBB")));
    InstrumentationRegistry.getInstrumentation().waitForIdleSync();

    // Check that the account was not added
    TestUtilities.assertDialogWasNotDisplayed(
        activityTestRule.getActivity(), AuthenticatorActivity.DIALOG_ID_SAVE_KEY);
    assertThat(mAccountDb.getAccounts()).isEmpty();
  }
Unit test for authenticator activity (part/shard 2).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityPart2Test.java