-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for ResetLogbackLoggingExtension
* Make logbackConfigFilePath final in ResetLogbackLoggingExtension * Add test that verifies default and custom config locations
- Loading branch information
1 parent
c72d357
commit 347166b
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/test/java/org/kiwiproject/test/junit/jupiter/ResetLogbackLoggingExtensionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.kiwiproject.test.junit.jupiter; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import ch.qos.logback.classic.ClassicConstants; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@DisplayName("ResetLogbackLoggingExtension") | ||
class ResetLogbackLoggingExtensionTest { | ||
|
||
@Test | ||
void shouldConstructWithLogbackTestFileAsDefaultConfigLocation() { | ||
var extension = new ResetLogbackLoggingExtension(); | ||
assertThat(extension.getLogbackConfigFilePath()) | ||
.isEqualTo(ClassicConstants.TEST_AUTOCONFIG_FILE); | ||
} | ||
|
||
@Test | ||
void shouldBuildWithLogbackTestFileAsDefaultConfigLocation() { | ||
var extension = ResetLogbackLoggingExtension.builder().build(); | ||
assertThat(extension.getLogbackConfigFilePath()) | ||
.isEqualTo(ClassicConstants.TEST_AUTOCONFIG_FILE); | ||
} | ||
|
||
@Test | ||
void shouldAllowCustomConfigLocation() { | ||
var customLocation = "acme-test-logback.xml"; | ||
|
||
var extension = ResetLogbackLoggingExtension.builder() | ||
.logbackConfigFilePath(customLocation) | ||
.build(); | ||
|
||
assertThat(extension.getLogbackConfigFilePath()).isEqualTo(customLocation); | ||
} | ||
} |