public final class Interceptor
extends java.lang.Object
Constructor and Description |
---|
Interceptor(java.lang.Class<?> loggingClass,
java.util.logging.Level level)
Creates a new instance for intercepting logging of the passed class at the specified
minimum level.
|
Modifier and Type | Method and Description |
---|---|
LoggingAssertions |
assertLog()
Obtains assertions for the accumulated log.
|
void |
intercept()
Installs the handler for intercepting the records.
|
java.util.logging.Level |
level()
Obtains the level of logging assigned for the tests.
|
java.lang.Class<?> |
loggingClass()
Obtains the class which logging operations are tested.
|
java.util.logging.Level |
previousLevel()
Obtains the level of the logging set for the logging class before the tests.
|
void |
release()
Returns the logger configuration to the previous state.
|
public Interceptor(java.lang.Class<?> loggingClass, java.util.logging.Level level)
public void intercept()
Current handlers are removed and remembered. The logger will also not use parent handlers.
release()
public void release()
public LoggingAssertions assertLog()
java.lang.IllegalStateException
- if the interceptor is not yet installed or already
releasedintercept()
,
release()
public java.lang.Class<?> loggingClass()
public java.util.logging.Level level()
public java.util.logging.Level previousLevel()