Unit Testing Log Messages Made Easy

As Java developers, we need to cover a lot of scenarios to ensure the quality of our software and catch bugs as soon as possible when introducing new code. For 99% of all my use cases, AssertJ, JUnit, Mockito, and Wiremock are sufficient enough to cover the test cases. But for the other use cases, like unit testing info, debugging or warning log messages, these frameworks don't help you out. There is also no other framework that can provide an easy to use method to capture log messages.

The answer which the community provided works well, but it needs a lot of boilerplate code to just assert your log events. So, I wanted to make it easier for myself and share it with you! This is how the LogCaptor library came into life.