public class NoWarningsLogChecker extends Object implements ILogChecker
Basic ILogChecker that will throw an AssertionError during finalCheck()
if there were any warnings or errors reported to addLogEvent(ILoggingEvent),
with separate counts of the errors and warnings reported.
| Modifier and Type | Field and Description |
|---|---|
protected int |
errorCount |
protected int |
warningCount |
| Constructor and Description |
|---|
NoWarningsLogChecker() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLogEvent(ch.qos.logback.classic.spi.ILoggingEvent event)
Provides the checker with a logging event.
|
void |
finalCheck()
Run any assertions (designed to be based on logging events received since the last call to
ILogChecker.init(Description)), potentially throwing an assertion failure to fail the test
if appropriate. |
void |
init(org.junit.runner.Description description)
Called before each JUnit
Test method. |
public void init(org.junit.runner.Description description)
ILogChecker
Called before each JUnit Test method.
This can be used to configure the instance, possibly optimizing it to only capture certain
levels or categories of logging events, etc.
Additional per-method configurations can be read from additional annotations as necessary.
init in interface ILogCheckerpublic void addLogEvent(ch.qos.logback.classic.spi.ILoggingEvent event)
ILogCheckerProvides the checker with a logging event. It is recommended to only keep track of anything to be reported. Immediately throwing as assertion failure is possible, but not recommended - as this method may not always be called from the main thread, causing a worker thread to terminate prematurely.
addLogEvent in interface ILogCheckerpublic void finalCheck()
throws Exception
ILogChecker
Run any assertions (designed to be based on logging events received since the last call to
ILogChecker.init(Description)), potentially throwing an assertion failure to fail the test
if appropriate.
finalCheck in interface ILogCheckerExceptionCopyright © 2017 Mark A. Ziesemer. All rights reserved.