### Question:
RxActivityResults { public <T> ObservableTransformer<T, ActivityResult> composer(final Intent intent) { return new ObservableTransformer<T, ActivityResult>() { @Override public ObservableSource<ActivityResult> apply(@NonNull Observable<T> upstream) { return request(upstream, intent); } }; } 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 composer() throws Exception { Intent someIntent = new Intent(); ActivityResult testResult = new ActivityResult(Activity.RESULT_OK, Activity.RESULT_OK, someIntent); TestObserver<ActivityResult> composerTest = trigger().compose(rxActivityResults.composer(someIntent)).test(); rxActivityResults.onActivityResult(testResult.getResultCode(), someIntent); composerTest.assertNoErrors() .assertSubscribed() .assertComplete() .assertValueCount(1) .assertValue(testResult); }
@Test(expected = IllegalArgumentException.class) public void requestNullIntent() throws Exception { TestObserver<ActivityResult> composerTest = trigger().compose(rxActivityResults.composer(null)).test(); composerTest.assertError(IllegalArgumentException.class) .assertSubscribed() .assertComplete() .assertValueCount(0); }