我正在尝试Mono.delay
使用StepVerifier
. 我的代码如下:
Mono[Long] mono = Mono.delay(Duration.ofDays(5));
StepVerifier.withVirtualTime(() -> mono)
.thenAwait(Duration.ofDays(5))
.expectNextCount(1)
.expectComplete()
.verify();
我得到以下堆栈跟踪
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)
跟踪源代码后,似乎执行器在方法上被关闭Schedulers.setFactory
我想知道我是否在这里遗漏了什么。