そのJavadocによると、最初の値が購読と最初の次のシグナルの間の経過時間になる場所Mono.elapse()
を生成します。Mono<Tuple2<Long, T>>
次のテストは機能しません
StepVerifier.withVirtualTime(() -> Mono.just(1)
.delaySubscription(Duration.ofSeconds(1))
.elapsed(),
() -> VirtualTimeScheduler.enable(true), 1)
.thenAwait(Duration.ofSeconds(1))
.expectNextMatches(tuple2 -> tuple2.getT1() >= 1000 && tuple2.getT2() == 1)
.verifyComplete();
例外がスローされます:
java.lang.AssertionError: expectation "expectNextMatches" failed (predicate failed on value: 11,1)
経過時間は少なくとも 1000 ミリ秒になると予想していましたが、実際にはわずか 11 ミリ秒でした。
ここで何かが恋しいですか?