Use ILC in test.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/25064ca1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/25064ca1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/25064ca1

Branch: refs/heads/master
Commit: 25064ca130c9733bfc36f5811d50f2a118014a32
Parents: 30bf32b
Author: Matt Sicker <[email protected]>
Authored: Sat Oct 4 12:01:50 2014 -0500
Committer: Matt Sicker <[email protected]>
Committed: Sat Oct 4 12:01:50 2014 -0500

----------------------------------------------------------------------
 .../test/java/org/apache/log4j/LoggingTest.java | 30 +++-----------------
 1 file changed, 4 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/25064ca1/log4j-1.2-api/src/test/java/org/apache/log4j/LoggingTest.java
----------------------------------------------------------------------
diff --git a/log4j-1.2-api/src/test/java/org/apache/log4j/LoggingTest.java 
b/log4j-1.2-api/src/test/java/org/apache/log4j/LoggingTest.java
index 0d0c341..c061bb9 100644
--- a/log4j-1.2-api/src/test/java/org/apache/log4j/LoggingTest.java
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/LoggingTest.java
@@ -16,14 +16,8 @@
  */
 package org.apache.log4j;
 
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.Configurator;
-import org.apache.logging.log4j.status.StatusLogger;
-import org.apache.logging.log4j.test.appender.ListAppender;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
+import org.apache.logging.log4j.junit.InitialLoggerContext;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -34,25 +28,9 @@ import static org.junit.Assert.*;
 public class LoggingTest {
 
     private static final String CONFIG = "log4j2-config.xml";
-    private static Configuration config;
-    private static ListAppender app;
-    private static LoggerContext ctx;
 
-    @BeforeClass
-    public static void setupClass() {
-        ctx = Configurator.initialize("Test1", CONFIG);
-    }
-
-    @AfterClass
-    public static void cleanupClass() {
-        ctx.stop();
-        StatusLogger.getLogger().reset();
-    }
-
-    @Before
-    public void before() {
-        config = ctx.getConfiguration();
-    }
+    @ClassRule
+    public static final InitialLoggerContext CTX = new 
InitialLoggerContext(CONFIG);
 
     @Test
     public void testParent() {

Reply via email to