Commit ca1510b7 authored by Mikael Ståldal's avatar Mikael Ståldal
Browse files

LOG4J2-1689 Adding unit test

parent 922e4829
Showing with 16 additions and 0 deletions
+16 -0
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
package org.apache.logging.log4j; package org.apache.logging.log4j;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -182,6 +183,21 @@ public class ThreadContextTest { ...@@ -182,6 +183,21 @@ public class ThreadContextTest {
assertTrue(ThreadContext.isEmpty()); assertTrue(ThreadContext.isEmpty());
} }
@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 @Test
public void testContainsKey() { public void testContainsKey() {
ThreadContext.clearMap(); ThreadContext.clearMap();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment