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/4a4000e1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4a4000e1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4a4000e1

Branch: 
refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 4a4000e16f0a44017b90b05777b3d878c951e853
Parents: f965d03
Author: Gary Gregory <ggreg...@apache.org>
Authored: Mon Aug 15 13:20:01 2016 -0700
Committer: Gary Gregory <ggreg...@apache.org>
Committed: Mon Aug 15 13:20:01 2016 -0700

----------------------------------------------------------------------
 log4j-nosql/pom.xml                                             | 5 +++++
 .../logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java  | 5 +++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4a4000e1/log4j-nosql/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-nosql/pom.xml b/log4j-nosql/pom.xml
index b93c191..6a75bcf 100644
--- a/log4j-nosql/pom.xml
+++ b/log4j-nosql/pom.xml
@@ -59,6 +59,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <type>test-jar</type>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-core</artifactId>
       <type>test-jar</type>
     </dependency>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4a4000e1/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java
----------------------------------------------------------------------
diff --git 
a/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java
 
b/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java
index c3c11d1..152b584 100644
--- 
a/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java
+++ 
b/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java
@@ -43,18 +43,23 @@ import org.apache.logging.log4j.MarkerManager;
 import org.apache.logging.log4j.ThreadContext;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.appender.AppenderLoggingException;
+import org.apache.logging.log4j.junit.ThreadContextStackRule;
 import org.apache.logging.log4j.message.Message;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class NoSqlDatabaseManagerTest {
     private NoSqlConnection<Map<String, Object>, DefaultNoSqlObject> 
connection;
     private NoSqlProvider<NoSqlConnection<Map<String, Object>, 
DefaultNoSqlObject>> provider;
 
+    @Rule
+    public final ThreadContextStackRule threadContextRule = new 
ThreadContextStackRule(); 
+
     @Before
     @SuppressWarnings("unchecked")
     public void setUp() {

Reply via email to