Skip to content

Different logging services can be tested using mock loggers backed by Mockito.

License

Notifications You must be signed in to change notification settings

vitalijr2/mock-loggers

Repository files navigation

Mock Loggers

Different logging services can be tested using mock loggers backed by Mockito.

Warning

This library does not support parallel test execution.

Java Version jUnit Version Mockito Version License
GitHub master check runs Codacy Badge Codacy Coverage GitHub commit activity Today's hits

How to use

The simplest usage example looks like this:

@Test
void helloWorld() {
    var helloService = new HelloService();

    assertDoesNotThrow(helloService::sayHelloWorld);

    verify(System.getLogger("HelloService")).log(Level.INFO, "Hello World!");
}

Now this library implements services for JDK Platform Logging, Apache Commons Logging and SLF4J.

See more examples in the relevant modules of this project:

Other logging libraries and frameworks

Credits

There are two projects which inspired me to make this library:

Contributing

Please read Contributing.

History

See Changelog

License

Copyright 2024 Vitalij Berdinskih

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Apache License v2.0