RxActivityLauncher { Observable<ActivityResult> startActivityForResult( final Action3<Intent, Integer, Bundle> launchActivityAction, final Intent intent, final int requestCode, final Bundle options) { final PublishSubject<ActivityResult> subject = createSubjectIfNotExist(requestCode, false); try { launchActivityAction.call(intent, requestCode, options); return subject; } catch (ActivityNotFoundException | SecurityException e) { subjects.remove(requestCode); return Observable.error(e); } } RxActivityLauncher();  RxActivityLauncher(@Nullable CompositeSubscription compositeSubscription); @CheckResult LaunchActivitySource from(@NonNull Activity source); @CheckResult LaunchActivitySource from(@NonNull android.support.v4.app.Fragment source); @CheckResult LaunchActivitySource from(@NonNull Fragment source); @CheckResult PendingLaunchActivitySource from(@NonNull PendingLaunchAction action); void onActivityResult(int requestCode, int resultCode, @Nullable Intent data);  }
@Test public void startActivityForResult_noTrigger_occurError() { doThrow(ActivityNotFoundException.class).when(launchAction) .call(any(Intent.class), anyInt(), any(Bundle.class)); final RxActivityLauncher launcher = new RxActivityLauncher(); final TestSubscriber<ActivityResult> testSubscriber = TestSubscriber.create(); launcher.startActivityForResult(launchAction, launchIntent, REQUEST_TEST_1, null) .subscribe(testSubscriber); testSubscriber.assertError(ActivityNotFoundException.class); testSubscriber.assertNotCompleted(); }