You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2016/11/11 14:51:20 UTC
logging-log4j2 git commit: LOG4J2-1689 Adding unit test
Repository: logging-log4j2
Updated Branches:
refs/heads/LOG4J2-1689 922e4829f -> ca1510b74
LOG4J2-1689 Adding unit test
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ca1510b7
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ca1510b7
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ca1510b7
Branch: refs/heads/LOG4J2-1689
Commit: ca1510b74e6e6e2674622e459309afe7856212cb
Parents: 922e482
Author: Mikael St�ldal <mi...@magine.com>
Authored: Fri Nov 11 15:51:10 2016 +0100
Committer: Mikael St�ldal <mi...@magine.com>
Committed: Fri Nov 11 15:51:10 2016 +0100
----------------------------------------------------------------------
.../org/apache/logging/log4j/ThreadContextTest.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ca1510b7/log4j-api/src/test/java/org/apache/logging/log4j/ThreadContextTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/ThreadContextTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/ThreadContextTest.java
index 07086af..e0731b3 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/ThreadContextTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/ThreadContextTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.logging.log4j;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -183,6 +184,21 @@ public class ThreadContextTest {
}
@Test
+ public void testRemoveAll() {
+ ThreadContext.clearMap();
+ ThreadContext.put("testKey1", "testValue1");
+ ThreadContext.put("testKey2", "testValue2");
+ assertEquals("testValue1", ThreadContext.get("testKey1"));
+ assertEquals("testValue2", ThreadContext.get("testKey2"));
+ assertFalse(ThreadContext.isEmpty());
+
+ ThreadContext.removeAll(Arrays.asList("testKey1", "testKey2"));
+ assertNull(ThreadContext.get("testKey1"));
+ assertNull(ThreadContext.get("testKey2"));
+ assertTrue(ThreadContext.isEmpty());
+ }
+
+ @Test
public void testContainsKey() {
ThreadContext.clearMap();
assertFalse(ThreadContext.containsKey("testKey"));