A StepVerifier provides a declarative way of creating a verifiable script for an async Publisher sequence, by expressing expectations about the events that will happen upon subscription. The verification must be triggered after the terminal expectations (completion, error, cancellation) have been declared, by calling one of the verify() methods.
Create a StepVerifier around a Publisher using create(Publisher) or withVirtualTime(Supplier
Set up individual value expectations using expectNext, expectNextMatches(Predicate), assertNext(Consumer), expectNextCount(long) or expectNextSequence(Iterable).
Trigger subscription actions during the verification using either thenRequest(long) or thenCancel().
Finalize the test scenario using a terminal expectation: expectComplete(), expectError(), expectError(Class), expectErrorMatches(Predicate), or thenCancel().
Trigger the verification of the resulting StepVerifier on its Publisher using either verify() or verify(Duration). (note some of the terminal expectations above have a "verify" prefixed alternative that both declare the expectation and trigger the verification).
If any expectations failed, an AssertionError will be thrown indicating the failures.