- Sometimes logging is important
JUnit 5 extension for testing log statements.
Add junit5-logging-extension as dependency within test scope to your project.
<dependency> <groupId>com.innoq</groupId> <artifactId>junit5-logging-extension</artifactId> <version>0.2.0</version> <scope>test</scope> </dependency>testImplementation 'com.innoq:junit5-logging-extension:0.2.0' testImplementation("com.innoq:junit5-logging-extension:0.2.0") Use the extension within your JUnit 5 tests:
@Logging class SomeTest { Logger LOG = LoggerFactory.getLogger(SomeTest.class); @Test void someTest(LoggingEvents events) { LOG.info("Some log message"); assertThat(events.isEmpty()).isFalse(); } }Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
junit5-logging-extension is Open Source software released under the Apache 2.0 license.