You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2022/06/05 00:06:04 UTC
[logging-log4j2] 05/08: Set up properties in test more reliably
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 6468579959544be47bdbe4c600ae6a0d7dff28cf
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Sat Jun 4 19:01:16 2022 -0500
Set up properties in test more reliably
Signed-off-by: Matt Sicker <ma...@apache.org>
---
.../org/apache/logging/log4j/spi/DefaultThreadContextMapTest.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/log4j-api-test/src/test/java/org/apache/logging/log4j/spi/DefaultThreadContextMapTest.java b/log4j-api-test/src/test/java/org/apache/logging/log4j/spi/DefaultThreadContextMapTest.java
index 2ee82bf2c5..c17b1c1c02 100644
--- a/log4j-api-test/src/test/java/org/apache/logging/log4j/spi/DefaultThreadContextMapTest.java
+++ b/log4j-api-test/src/test/java/org/apache/logging/log4j/spi/DefaultThreadContextMapTest.java
@@ -17,7 +17,9 @@
package org.apache.logging.log4j.spi;
import org.apache.logging.log4j.test.junit.UsingThreadContextMap;
+import org.apache.logging.log4j.util.PropertiesUtil;
import org.junit.jupiter.api.Test;
+import org.junitpioneer.jupiter.ClearSystemProperty;
import org.junitpioneer.jupiter.SetSystemProperty;
import java.util.HashMap;
@@ -185,7 +187,7 @@ public class DefaultThreadContextMapTest {
}
@Test
- public void testGetImmutableMapCopyNotAffectdByContextMapChanges() {
+ public void testGetImmutableMapCopyNotAffectedByContextMapChanges() {
final DefaultThreadContextMap map = new DefaultThreadContextMap(true);
map.put("key1", "value1");
assertFalse(map.isEmpty());
@@ -214,8 +216,9 @@ public class DefaultThreadContextMapTest {
}
@Test
- @SetSystemProperty(key = DefaultThreadContextMap.INHERITABLE_MAP, value = "false")
+ @ClearSystemProperty(key = DefaultThreadContextMap.INHERITABLE_MAP)
public void testThreadLocalNotInheritableByDefault() {
+ PropertiesUtil.getProperties().reload();
ThreadContextMapFactory.init();
final ThreadLocal<Map<String, String>> threadLocal = DefaultThreadContextMap.createThreadLocalMap(true);
assertFalse(threadLocal instanceof InheritableThreadLocal<?>);
@@ -224,6 +227,7 @@ public class DefaultThreadContextMapTest {
@Test
@SetSystemProperty(key = DefaultThreadContextMap.INHERITABLE_MAP, value = "true")
public void testThreadLocalInheritableIfConfigured() {
+ PropertiesUtil.getProperties().reload();
ThreadContextMapFactory.init();
final ThreadLocal<Map<String, String>> threadLocal = DefaultThreadContextMap.createThreadLocalMap(true);
assertTrue(threadLocal instanceof InheritableThreadLocal<?>);