I am learning Reactive Programming from that page: tutorial. And I am wondering why in the below example stact trace throws error with actual one record when I expect 4?
java.lang.AssertionError: expectation "expectNextCount(4)" failed (expected: count = 4; actual: counted = 1; signal: onComplete())
// TODO Create a StepVerifier that initially requests all values and expect 4 values to be received
StepVerifier requestAllExpectFour(Flux<User> flux) {
return StepVerifier.withVirtualTime(() -> Flux.just(flux))
.expectSubscription()
.thenRequest(4)
.expectNextCount(4)
.expectComplete();
}
I'm wondering if I'm missing something here.
try this
StepVerifier requestAllExpectFour(Flux<User> flux) {
return StepVerifier.withVirtualTime(() -> flux)
.expectSubscription()
.thenRequest(Long.MAX_VALUE)
.expectNextCount(4)
.expectComplete();
}
or like this
StepVerifier requestAllExpectFour(Flux<User> flux) {
return StepVerifier.create(flux)
.expectSubscription()
.thenRequest(Long.MAX_VALUE)
.expectNextCount(4)
.expectComplete();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With