So I have a class that has a method that logs a message:
class Car {
private Logger logger = LoggerFactory.getLogger(Car.class);
void startCar() {
My Loggers are private static final so I cannot use solution mentioned above and rather not use Reflection. Alternative below.
If you are using Spring, you have acces to OutputCaptureRule.
@Rule
OutputCaptureRule outputCaptureRule = new OutputCaptureRule()
def test(){
outputCaptureRule.getAll().contains("")
}