Suppose I want to test that this method prints a log.warn message if the Flux is empty
@Slf4j
class SomeClass {
void someMethod(Flux<Integer> intFlux) {
intFlux.switchIfEmpty(Mono.defer(() -> {
log.warn("No integers!");
return Mono.empty();
}))
.subscribe(/* consume */);
}
}
How can I do it? Specifically, how can I assert on Lombok's logger, if it's at all possible? It's not passed into the constructor, I can't mock() and verify(). Is it the only option to simply get rid of Lombok?
Intercept sysout: