You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/08/19 07:15:42 UTC
[17/50] logging-log4j2 git commit: Use a ThreadContextRule to clean
up tests.
Use a ThreadContextRule to clean up tests.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e88800c7
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e88800c7
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e88800c7
Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: e88800c7665311b28a0f1ee0747e780f0a78a14c
Parents: 4a4000e
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Aug 15 13:23:40 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Aug 15 13:23:40 2016 -0700
----------------------------------------------------------------------
.../logging/log4j/core/filter/DynamicThresholdFilterTest.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e88800c7/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilterTest.java
index 087eaa0..21f1ca0 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilterTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/DynamicThresholdFilterTest.java
@@ -32,9 +32,11 @@ import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.util.KeyValuePair;
+import org.apache.logging.log4j.junit.ThreadContextMapRule;
import org.apache.logging.log4j.message.SimpleMessage;
import org.apache.logging.log4j.status.StatusLogger;
import org.junit.After;
+import org.junit.Rule;
import org.junit.Test;
/**
@@ -42,6 +44,9 @@ import org.junit.Test;
*/
public class DynamicThresholdFilterTest {
+ @Rule
+ public final ThreadContextMapRule threadContextRule = new ThreadContextMapRule();
+
@After
public void cleanup() {
final LoggerContext ctx = LoggerContext.getContext(false);
@@ -69,7 +74,6 @@ public class DynamicThresholdFilterTest {
assertSame(Filter.Result.DENY, filter.filter(event));
event = Log4jLogEvent.newBuilder().setLevel(Level.ERROR).setMessage(new SimpleMessage("Test")).build();
assertSame(Filter.Result.NEUTRAL, filter.filter(event));
- ThreadContext.clearMap();
}
@Test