Workflow { public io.reactivex.Single<Optional<TReturnValue>> createSingle( TRootActionableItem rootActionableItem) { return getSteps(rootActionableItem).asResultObservable().singleOrError(); }  io.reactivex.Single<Optional<TReturnValue>> createSingle(
      TRootActionableItem rootActionableItem);  }
@Test public void createSingle_shouldReturnASingleThatRunsTheWorkflow() { ActionableItem actionableItem = new ActionableItem() { @NonNull @Override public Observable<InteractorEvent> lifecycle() { return interactorLifecycleSubject; } }; Workflow<Object, ActionableItem> workflow = new Workflow<Object, ActionableItem>() { @NonNull @Override protected Step<Object, ActionableItem> getSteps(@NonNull ActionableItem actionableItem) { return Step.from(returnValueSubject.singleOrError()); } }; TestObserver<Optional<Object>> testSubscriber = new TestObserver<>(); workflow.createSingle(actionableItem).subscribe(testSubscriber); interactorLifecycleSubject.onNext(InteractorEvent.ACTIVE); Object returnValue = new Object(); returnValueSubject.onNext(new Step.Data<>(returnValue, actionableItem)); returnValueSubject.onComplete(); testSubscriber.assertValueCount(1); assertThat(testSubscriber.values().get(0).get()).isEqualTo(returnValue); testSubscriber.assertComplete(); testSubscriber.assertNoErrors(); }