Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
Logging Log4j2
Commits
ca1510b7
Commit
ca1510b7
authored
8 years ago
by
Mikael Ståldal
Browse files
Options
Download
Email Patches
Plain Diff
LOG4J2-1689 Adding unit test
parent
922e4829
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
log4j-api/src/test/java/org/apache/logging/log4j/ThreadContextTest.java
+16
-0
...test/java/org/apache/logging/log4j/ThreadContextTest.java
with
16 additions
and
0 deletions
+16
-0
log4j-api/src/test/java/org/apache/logging/log4j/ThreadContextTest.java
+
16
-
0
View file @
ca1510b7
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment