@Test public void multipleMonoToFlux() { Mono<User> skylerMono = repository1.findFirst(); Mono<User> marieMono = repository2.findFirst(); Flux<User> flux = createFluxFromMultipleMono(skylerMono, marieMono); TestSubscriber.subscribe(flux).await().assertValues(User.SKYLER, MARIE).assertComplete(); }
@Test public void mergeWithNoInterleave() { Flux<User> flux = mergeFluxWithNoInterleave(repository1.findAll(), repository2.findAll()); TestSubscriber.subscribe(flux) .await() .assertValues(User.SKYLER, User.JESSE, User.WALTER, User.SAUL, MARIE, MIKE) .assertComplete(); }
@Test public void singleConversion() { Mono<User> mono = repository.findFirst(); Single<User> single = fromMonoToSingle(mono); TestSubscriber<User> testSubscriber = new TestSubscriber<>(); testSubscriber .bindTo(fromSingleToMono(single)) .await() .assertValues(User.SKYLER) .assertComplete(); }
@Test public void completableFutureConversion() { Mono<User> mono = repository.findFirst(); CompletableFuture<User> future = fromMonoToCompletableFuture(mono); TestSubscriber<User> testSubscriber = new TestSubscriber<>(); testSubscriber .bindTo(fromCompletableFutureToMono(future)) .await() .assertValues(User.SKYLER) .assertComplete(); }
@Test public void observableConversion() { Flux<User> flux = repository.findAll(); Observable<User> observable = fromFluxToObservable(flux); TestSubscriber<User> testSubscriber = new TestSubscriber<>(); testSubscriber .bindTo(fromObservableToFlux(observable)) .await() .assertValues(User.SKYLER, User.JESSE, User.WALTER, User.SAUL) .assertComplete(); }