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:34 UTC
[09/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/c8db0386
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c8db0386
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c8db0386
Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: c8db0386da4251a40b4becc712c894a2288f5b80
Parents: cdd636b
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Aug 15 13:09:47 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Aug 15 13:09:47 2016 -0700
----------------------------------------------------------------------
.../org/apache/logging/log4j/core/layout/HtmlLayoutTest.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c8db0386/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/HtmlLayoutTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/HtmlLayoutTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/HtmlLayoutTest.java
index cf38518..80acb1f 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/HtmlLayoutTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/HtmlLayoutTest.java
@@ -27,9 +27,11 @@ import org.apache.logging.log4j.core.BasicConfigurationFactory;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.apache.logging.log4j.junit.ThreadContextRule;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -43,9 +45,11 @@ public class HtmlLayoutTest {
static ConfigurationFactory cf = new BasicConfigurationFactory();
+ @Rule
+ public final ThreadContextRule threadContextRule = new ThreadContextRule();
+
@BeforeClass
public static void setupClass() {
- ThreadContext.clearAll();
ConfigurationFactory.setConfigurationFactory(cf);
final LoggerContext ctx = LoggerContext.getContext();
ctx.reconfigure();
@@ -54,7 +58,6 @@ public class HtmlLayoutTest {
@AfterClass
public static void cleanupClass() {
ConfigurationFactory.removeConfigurationFactory(cf);
- ThreadContext.clearAll();
}
private static final String body = "<tr><td bgcolor=\"#993300\" style=\"color:White; font-size : small;\" colspan=\"6\">java.lang.NullPointerException: test";