Fix system property resets in unit 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/3efa9d41 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3efa9d41 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3efa9d41 Branch: refs/heads/LOG4J2-1431 Commit: 3efa9d41eaeb118bd5de28613d32e99cbfe0de01 Parents: bf06bb2 Author: Matt Sicker <[email protected]> Authored: Sat Aug 26 14:26:42 2017 -0500 Committer: Matt Sicker <[email protected]> Committed: Sat Aug 26 15:50:56 2017 -0500 ---------------------------------------------------------------------- .../logging/log4j/core/util/ClockFactoryTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3efa9d41/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java index c9b3b91..309cc77 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java @@ -16,16 +16,16 @@ */ package org.apache.logging.log4j.core.util; -import static org.junit.Assert.assertSame; - import java.lang.reflect.Field; import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.logging.log4j.core.async.AsyncLogger; import org.apache.logging.log4j.core.impl.Log4jLogEvent; -import org.junit.AfterClass; +import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.*; + public class ClockFactoryTest { public static void resetClocks() throws IllegalAccessException { @@ -40,11 +40,11 @@ public class ClockFactoryTest { FieldUtils.writeStaticField(field, ClockFactory.getClock(), false); } - @AfterClass - public static void afterClass() throws IllegalAccessException { + @Before + public void setUp() throws Exception { resetClocks(); } - + @Test public void testDefaultIsSystemClock() { System.clearProperty(ClockFactory.PROPERTY_NAME);
