private void callOnActivityResultOnUiThreadWithScannedUri(String uri) {
    Intent intent = new Intent(Intent.ACTION_VIEW, null);
    intent.putExtra(BarcodeCaptureActivity.INTENT_EXTRA_BARCODE_VALUE, uri);
    TestUtilities.invokeOnActivityResultOnUiThread(
        activityTestRule.getActivity(),
        AuthenticatorActivity.SCAN_REQUEST, Activity.RESULT_OK, intent);
  }
Invokes the activity's {@code onActivityResult} as though it received the specified scanned
URI.
javatests/com/google/android/apps/authenticator/AuthenticatorActivityPart2Test.java