Testing Mono.delay with StepVerifier
<p>I'm trying to test <code>Mono.delay</code> using <code>StepVerifier</code>.
My code is as follow:</p>

<pre><code>Mono[Long] mono = Mono.delay(Duration.ofDays(5));

StepVerifier.withVirtualTime(() -&gt; mono)
    .thenAwait(Duration.ofDays(5))
    .expectNextCount(1)
    .expectComplete()
    .verify();
</code></pre>

<p>And I'm getting the following stacktrace</p>

<pre><code>expectation "expectNextCount" failed (expected: count = 1; actual: counted = 0; signal: onError(reactor.core.Exceptions$BubblingException:
java.util.concurrent.RejectedExecutionException: Scheduler unavailable))
java.lang.AssertionError: expectation "expectNextCount" failed (expected: count = 1; actual: counted = 0; signal: onError(reactor.core.Exceptions$BubblingException: java.util.concurrent.RejectedExecutionException: Scheduler unavailable))
at reactor.test.DefaultStepVerifierBuilder.failPrefix(DefaultStepVerifierBuilder.java:1679)
at reactor.test.DefaultStepVerifierBuilder.fail(DefaultStepVerifierBuilder.java:1675)
at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.checkCountMismatch(DefaultStepVerifierBuilder.java:886)
at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onSignalCount(DefaultStepVerifierBuilder.java:1112)
at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onExpectation(DefaultStepVerifierBuilder.java:963)
at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onError(DefaultStepVerifierBuilder.java:727)
at reactor.core.publisher.MonoDelay.subscribe(MonoDelay.java:59)
at reactor.test.DefaultStepVerifierBuilder$DefaultStepVerifier.verify(DefaultStepVerifierBuilder.java:532)
at reactor.test.DefaultStepVerifierBuilder$DefaultStepVerifier.verify(DefaultStepVerifierBuilder.java:508)
</code></pre>

<p>After tracing the source code, it seems that the executors are shutdown on the method <code>Schedulers.setFactory</code></p>

<p>I'm wondering if I'm missing something here.</p>