This is an automated email from the ASF dual-hosted git repository. mattsicker pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 018f72ab2a62efda1f2bb55231135f9d044a6dcc Author: Matt Sicker <[email protected]> AuthorDate: Mon Sep 7 13:39:45 2020 -0500 Fix Windows file removal errors Signed-off-by: Matt Sicker <[email protected]> --- .../log4j/core/config/ConfigurationFactoryTest.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ConfigurationFactoryTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ConfigurationFactoryTest.java index b076721..4ebd877 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ConfigurationFactoryTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ConfigurationFactoryTest.java @@ -24,6 +24,7 @@ import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.appender.ConsoleAppender; import org.apache.logging.log4j.core.filter.ThreadContextMapFilter; +import org.apache.logging.log4j.junit.CleanUpFiles; import org.apache.logging.log4j.junit.LoggerContextSource; import org.apache.logging.log4j.util.Strings; import org.junit.jupiter.api.Tag; @@ -40,6 +41,13 @@ import java.util.Map; import static org.apache.logging.log4j.util.Unbox.box; import static org.junit.jupiter.api.Assertions.*; +@CleanUpFiles({ + "target/test-xml.log", + "target/test-xinclude.log", + "target/test-json.log", + "target/test-yaml.log", + "target/test-properties.log" +}) class ConfigurationFactoryTest { static final String LOGGER_NAME = "org.apache.logging.log4j.test1.Test"; @@ -77,13 +85,9 @@ class ConfigurationFactoryTest { final long currentThreadId = Thread.currentThread().getId(); final Logger logger = context.getLogger(FILE_LOGGER_NAME); logger.debug("Greetings from ConfigurationFactoryTest in thread#{}", box(currentThreadId)); - try { - final List<String> lines = Files.readAllLines(logFile); - assertEquals(1, lines.size()); - assertTrue(lines.get(0).endsWith(Long.toString(currentThreadId))); - } finally { - Files.delete(logFile); - } + final List<String> lines = Files.readAllLines(logFile); + assertEquals(1, lines.size()); + assertTrue(lines.get(0).endsWith(Long.toString(currentThreadId))); } @Test
