@Test
  public void testAddAccountFabScanBarcodeItetap() {
    accountDb.add("johndoeTotp@gmail.com", "7777777777777777", OtpType.TOTP, null, null, null);

    AuthenticatorActivity activity = activityTestRule.launchActivity(null);

    ListView userList = activity.findViewById(R.id.user_list);
    assertThat(userList.getChildCount()).isEqualTo(1);

    onView(withId(R.id.add_account_fab)).check(matches(isDisplayed()));
    onView(withId(R.id.add_account_fab)).perform(click());

    assertThat(activity.bottomSheetDialog).isNotNull();
    assertThat(activity.bottomSheetDialog.isShowing()).isTrue();
    onView(withId(R.id.bottom_sheet_scan_barcode_layout)).check(matches(isDisplayed()));
    onView(withId(R.id.bottom_sheet_scan_barcode_layout)).perform(click());

    Intent expectedIntent =
        AuthenticatorActivity.getLaunchIntentActionScanBarcode(
            activityTestRule.getActivity(), false);
    intended(
        allOf(
            hasAction(AuthenticatorActivity.ACTION_SCAN_BARCODE),
            hasComponent(equalTo(expectedIntent.getComponent()))));
    assertThat(TestUtilities.isStrayIntentRemaining()).isFalse();
  }
Unit tests for {@link AuthenticatorActivity} (part/shard 1).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityTest.java