From 2242e242bb2da682cf13c0c4d866f64a68f03691 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Tue, 22 Oct 2013 16:21:40 -0400 Subject: Reset the LogConfig in unit tests LogConfig is globally shared. Fix unit tests that modify the logging configuration to reset it after (and before) to avoid affecting other unit tests or being affected by the results of other tests. Before this patch, if the tests were executed in a certain order, it was possible for them to leave behind a LogConfig that enabled logging in the most verbose manner possible. This would generate megabytes of output when running unit tests. 2013-10-22 Omair Majid * netx/net/sourceforge/jnlp/util/logging/LogConfig.java (resetLogConfig): New method. * tests/netx/unit/net/sourceforge/jnlp/util/logging/OutputControllerTest.java (setUp, tearDown): New method. --- netx/net/sourceforge/jnlp/util/logging/LogConfig.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'netx/net/sourceforge/jnlp/util/logging/LogConfig.java') diff --git a/netx/net/sourceforge/jnlp/util/logging/LogConfig.java b/netx/net/sourceforge/jnlp/util/logging/LogConfig.java index 5e1644c..70db30c 100644 --- a/netx/net/sourceforge/jnlp/util/logging/LogConfig.java +++ b/netx/net/sourceforge/jnlp/util/logging/LogConfig.java @@ -98,6 +98,13 @@ public class LogConfig { return logConfig; } + /** For testing only: throw away the previous config */ + static void resetLogConfig() { + if (logConfig != null) { + logConfig = new LogConfig(); + } + } + public String getIcedteaLogDir() { return icedteaLogDir; } -- cgit v1.2.3