Reputation: 26441
I would like to verify that every onNext emission matches the given predicate.
I tried expectNextMatches
:
StepVerifier.create(...)
.expectNextMatches { it.status != "SUCCESS" }
.expectComplete()
.verify()
However, it matches only one emission, not every single one.
Upvotes: 2
Views: 1710
Reputation: 6255
There's an operator for that:
StepVerifier.create(...)
.thenConsumeWhile(it -> it.status != "SUCCESS")
.expectComplete()
.verify();
If there is any element in the sequence that doesn't match, the StepVerifier
will error.
Upvotes: 6