I attempt to write a test function for a service that consumes an interval Flux from another service, created like Flux.interval(Duration.ofSeconds(1)).map( ... )
.
If seen Support of MockRestServiceServer for WebClient, which is exactly what I would need. However, at present it is recommended to use OkHttp MockWebServer instead. My question now is: How do I mock a server response that provides an interval Flux?
The setBody()
function of MockResponse accepts String and Buffer. Probably Buffer is the way to go. However, I don't know how to convert the Flux
into a say InputStream
or so, that could be read into the buffer.