Clear loggers at the beginning of tests, not at the end
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 3 Jun 2016 19:49:37 +0000 (15:49 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 3 Jun 2016 19:51:14 +0000 (15:51 -0400)
That way the very first test will also get a clean state.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLoggerHierarchyListIT.java

index 4254aafec7ef95b85ff6b8899aa6147afb9ebcff..e53e4a7e664ed63510831e7271e7d5d1eb22e821 100644 (file)
@@ -25,6 +25,7 @@ import java.util.logging.Logger;
 
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -90,7 +91,23 @@ public class JulLoggerHierarchyListIT extends LoggerHierachyListITBase {
     }
 
     /**
-     *
+     * Test setup
+     */
+    @SuppressWarnings("static-method")
+    @Before
+    public void setup() {
+        /*
+         * Kind of hackish, but it's the only way to ensure that loggers are
+         * really removed in-between tests, since LogManager does not provide a
+         * way to forcibly remove a logger, and it doesn't seem like it will any
+         * time soon, see http://bugs.java.com/view_bug.do?bug_id=4811930
+         */
+        LogManager.getLogManager().reset();
+        System.gc();
+    }
+
+    /**
+     * Test cleanup
      */
     @After
     public void cleanup() {
@@ -111,15 +128,6 @@ public class JulLoggerHierarchyListIT extends LoggerHierachyListITBase {
             }
             childLogger = null;
         }
-
-        /*
-         * Kind of hackish, but it's the only way to ensure that loggers are
-         * really removed in-between tests, since LogManager does not provide a
-         * way to forcibly remove a logger, and it doesn't seem like it will any
-         * time soon, see http://bugs.java.com/view_bug.do?bug_id=4811930
-         */
-        LogManager.getLogManager().reset();
-        System.gc();
     }
 
     // ------------------------------------------------------------------------
This page took 0.024568 seconds and 4 git commands to generate.