October 2018
Intermediate to advanced
556 pages
15h 18m
English
The first step of the publisher's testing is the verification of the infinite Publisher. According to the Reactive Streams specification, an infinite stream means that the stream will never call the Subscriber#onComplete() method. In turn, this means that the testing techniques that we may have learned before will not work anymore. The problem here is that StepVerifier is going to wait for the completion signal infinitely. Consequently, the test will be blocked until it is killed. To fix that problem, StepVerifier offers a cancellation API that unsubscribes from the source when some expectations are satisfied, as shown in the following code:
Flux<String> websocketPublisher = ... StepVerifier .create(websocketPublisher) ...
Read now
Unlock full access