In many case we want to test if our application logging is implemented in proper way.
This is another easy way to testing what our application logs when we use
slf4j-mock we can mock all logger and assert it as we do with other mocked method.
Feature of library:
Mockito mock for each Logger
- all call to Logger method are delegated to instance of SimpleLogger,
so you can create standard
- light transitive dependencies - only
First we should add
slf4j-mock binding as dependency to our project,
we must remember that we can have only one slf4j binding on classpath.
Now we have class which does some logging action
And finally we write test for it
As we see thanks mocking slf4j logger we can prepare test for many scenario which we want.
In case of new requirement, bugs or other feedback we invite to github project
slf4j mock testing