Chapter 10: Testing and Debugging

  1. Which test utility class is available in Reactor to validate the invoked operations on a stream?

Reactor provides the StepVerifier component to validate the required operations in isolation.

  1. What is the difference between PublisherProbe and TestPublisher?

The PublisherProbe utility can instrument an existing publisher. The probe keeps track of signals published by the publisher, which can be validated at the end of the test. On the other hand, TestPublisher is capable of generating the Publisher stub, which can be used to unit test Reactor operators. 

  1. How should the virtual clock be configured to validate time-bound operations ?

The virtual clock must be injected before performing any time-based operations.  ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.