WebFlux test another thread

133 views Asked by At

How properly test webflux method with long operation

For example Spring Webflux / Reactor release calling thread

@GetMapping("/foo")
public Mono<Void> bar() {
    return Mono.fromCallable(() -> someService.veryLongSyncOperation())
            .subscribeOn(Schedulers.elastic())
            .then();
}

I return Mono but veryLongSyncOperation works.

So how properly write test with StepVerifier for such method without Thread.sleep(XXX); Get results of veryLongSyncOperation and check them.

0

There are 0 answers