### Question:
RetrieveCreditDraftList implements RetrieveInteractor<Void, List<CreditDraft>> { @NonNull @Override public Observable<List<CreditDraft>> getBehaviorStream(@NonNull final Option<Void> params) { return creditRepository.getAllCreditDrafts() .flatMapSingle(this::fetchWhenNoneAndThenDrafts) .compose(UnwrapOptionTransformer.create()); } @Inject  RetrieveCreditDraftList(@NonNull final CreditRepository creditRepository); @NonNull @Override Observable<List<CreditDraft>> getBehaviorStream(@NonNull final Option<Void> params);  }### Answer:
@Test public void draftsFromRepoAreUnwrappedAndPassedOn() { List<CreditDraft> testDraftList = createTestDraftList(); interactor.getBehaviorStream(Option.none()).subscribe(ts); arrangeBuilder.emitDraftListFromRepo(Option.ofObj(testDraftList)); ts.assertNotTerminated(); ts.assertValue(testDraftList); }
@Test public void whenRepoIsEmptyFetchAndNoEmissions() { arrangeBuilder.emitDraftListFromRepo(Option.none()) .withSuccessfulFetch(); interactor.getBehaviorStream(Option.none()).subscribe(ts); verify(creditRepository).fetchCreditDrafts(); ts.assertNoValues(); ts.assertNotTerminated(); }
@Test public void propagateFetchError() { Throwable throwable = Mockito.mock(Throwable.class); arrangeBuilder.emitDraftListFromRepo(Option.none()) .withFetchError(throwable); interactor.getBehaviorStream(Option.none()).subscribe(ts); verify(creditRepository).fetchCreditDrafts(); ts.assertNoValues(); ts.assertError(throwable); }