@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(); }