Testing Reactive data transactions
Using the Spring Test framework, Reactive Stream events can be tested using reactor.test.StepVerifier
which contains all the expectations and verifications needed to validate whether the output Stream data complies with the expected result or if the event is not properly composed of the appropriate operators.
Getting ready
Open the same ch07
project and create a number of test cases depicting the use of StepVerifier
.
How to do it...
Aside from typical @Test
execution, Reactive Stream has a dedicated API called StepVerifier
, which can be used to verify if its Stream emission is appropriate for a certain requirement. Let us use the following steps to test Reactive Stream operations:
StepVerifier
is part of the Reactor Core add-ons so add this dependency topom.xml
:
<dependency> <groupId>io.projectreactor.addons</groupId> <artifactId>reactor-test</artifactId> <version>3.0.7.RELEASE</version> <scope...