Class LoggingListener
- java.lang.Object
-
- org.junit.runner.notification.RunListener
-
- org.elasticsearch.test.junit.listeners.LoggingListener
-
public class LoggingListener extends org.junit.runner.notification.RunListenerARunListenerthat allows changing the log level for a specific test method. When a test method is annotated with theTestLoggingannotation, the level for the specified loggers will be internally saved before the test method execution and overridden with the specified ones. At the end of the test method execution the original loggers levels will be restored. This class is not thread-safe. Given the static nature of the logging API, it assumes that tests are never run concurrently in the same JVM. For the very same reason no synchronization has been implemented regarding the save/restore process of the original loggers levels.
-
-
Constructor Summary
Constructors Constructor Description LoggingListener()
-
Method Summary
Modifier and Type Method Description voidtestFinished(org.junit.runner.Description description)voidtestRunFinished(org.junit.runner.Result result)voidtestRunStarted(org.junit.runner.Description description)voidtestStarted(org.junit.runner.Description description)
-
-
-
Method Detail
-
testRunStarted
public void testRunStarted(org.junit.runner.Description description) throws java.lang.Exception- Overrides:
testRunStartedin classorg.junit.runner.notification.RunListener- Throws:
java.lang.Exception
-
testRunFinished
public void testRunFinished(org.junit.runner.Result result) throws java.lang.Exception- Overrides:
testRunFinishedin classorg.junit.runner.notification.RunListener- Throws:
java.lang.Exception
-
testStarted
public void testStarted(org.junit.runner.Description description) throws java.lang.Exception- Overrides:
testStartedin classorg.junit.runner.notification.RunListener- Throws:
java.lang.Exception
-
testFinished
public void testFinished(org.junit.runner.Description description) throws java.lang.Exception- Overrides:
testFinishedin classorg.junit.runner.notification.RunListener- Throws:
java.lang.Exception
-
-