From 2d10b46df241327d665098a85bd6ac48ca88ddbc Mon Sep 17 00:00:00 2001 From: ljacqu Date: Fri, 22 Jul 2016 22:49:11 +0200 Subject: [PATCH] Set ConsoleLogger not to use log file after running ConsoleLoggerTest --- src/test/java/fr/xephi/authme/ConsoleLoggerTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/fr/xephi/authme/ConsoleLoggerTest.java b/src/test/java/fr/xephi/authme/ConsoleLoggerTest.java index 5bf775ec1..52a7a6463 100644 --- a/src/test/java/fr/xephi/authme/ConsoleLoggerTest.java +++ b/src/test/java/fr/xephi/authme/ConsoleLoggerTest.java @@ -6,6 +6,7 @@ import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.util.StringUtils; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -68,6 +69,16 @@ public class ConsoleLoggerTest { ConsoleLogger.close(); } + /** + * Resets the ConsoleLogger back to its defaults after running all tests. Especially important + * is that we no longer enable logging to a file as the log file we've supplied will no longer + * be around after this test class has finished. + */ + @AfterClass + public static void resetConsoleToDefault() { + ConsoleLogger.setLoggingOptions(newSettings(false, LogLevel.FINE)); + } + @Test public void shouldLogToFile() throws IOException { // given