### Question:
RxActivityResults { public <T> ObservableTransformer<T, Boolean> ensureOkResult(final Intent intent) { return new ObservableTransformer<T, Boolean>() { @Override public ObservableSource<Boolean> apply(@NonNull Observable<T> upstream) { return request(upstream, intent).map(new Function<ActivityResult, Boolean>() { @Override public Boolean apply(@NonNull ActivityResult activityResult) throws Exception { return activityResult.isOk(); } }); } }; } RxActivityResults(@NonNull Activity activity); ObservableTransformer<T, ActivityResult> composer(final Intent intent); ObservableTransformer<T, Boolean> ensureOkResult(final Intent intent); Observable<ActivityResult> start(Intent intent); void setLogging(boolean logging);  }### Answer:
@Test public void ensureOkResult() throws Exception { Intent someIntent = new Intent(); ActivityResult testResult = new ActivityResult(Activity.RESULT_OK, Activity.RESULT_OK, someIntent); TestObserver<Boolean> composerTest = trigger().compose(rxActivityResults.ensureOkResult(someIntent)).test(); rxActivityResults.onActivityResult(testResult.getResultCode(), someIntent); composerTest.assertNoErrors() .assertSubscribed() .assertComplete() .assertValueCount(1) .assertValue(testResult.isOk()); }