With StepVerifier
it is very easy to check whether provided Mono
has completed (just by expectComplete()
method in StepVerifier
), but what should I do if need to check the opposite case ?
I tried to use this approach:
@Test
public void neverMonoTest() {
Mono<String> neverMono = Mono.never();
StepVerifier.create(neverMono)
.expectSubscription()
.expectNoEvent(Duration.ofSeconds(1))
.thenCancel()
.verify();
}
and such test passes. But this is false positive, because when I replace Mono.never()
with Mono.empty()
the test is still green.
Is there any better and reliable method to check lack of Mono's completion (of course within given scope of time) ?