Skip to content

JUnit 5 extension for testing log statements

License

Notifications You must be signed in to change notification settings

innoq/junit5-logging-extension

Repository files navigation

JUnit 5 logging extension

- Sometimes logging is important

Maven Central License Open Issues Build Status

JUnit 5 extension for testing log statements.

Quick Start

Add junit5-logging-extension as dependency within test scope to your project.

Apache Maven

<dependency>
  <groupId>com.innoq</groupId>
  <artifactId>junit5-logging-extension</artifactId>
  <version>0.2.0</version>
  <scope>test</scope>
</dependency>

Gradle Groovy DSL

testImplementation 'com.innoq:junit5-logging-extension:0.2.0'

Gradle Kotlin DSL

testImplementation("com.innoq:junit5-logging-extension:0.2.0")

Use the extension within your JUnit 5 tests:

Usage

@Logging
class SomeTest {

    Logger LOG = LoggerFactory.getLogger(SomeTest.class);

    @Test
    void someTest(LoggingEvents events) {
        LOG.info("Some log message");

        assertThat(events.isEmpty()).isFalse();
    }
}

Code of Conduct

Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

License

junit5-logging-extension is Open Source software released under the Apache 2.0 license.