@Test
  public void testIntentActionScanBarcodeWithoutCameraFeature() {
    when(mockBarcodeConditionChecker.isCameraAvailableOnDevice(any(Activity.class)))
        .thenReturn(false);

    activityTestRule.launchActivity(new Intent(AuthenticatorActivity.ACTION_SCAN_BARCODE));

    TestUtilities.assertDialogWasDisplayed(
        activityTestRule.getActivity(), AuthenticatorActivity.DIALOG_ID_CAMERA_NOT_AVAILABLE);
  }
Unit tests for {@link AuthenticatorActivity} (part/shard 1).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityTest.java