public class LogRule extends Object implements org.junit.rules.TestRule
@Rule public LogRule logRule = new LogRule() {{
record(LogLevel.WARN);
recordLoggingForType(RestrictParseLocationEventHandler.class);
}};
| Modifier and Type | Class and Description |
|---|---|
static class |
LogRule.LogLevel
Helper class to represent Logging levels to capture.
|
class |
LogRule.LogStatement
The actual code that executes our capturing logic before the test runs and removes it after it has run.
|
| Constructor and Description |
|---|
LogRule() |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement statement,
org.junit.runner.Description description) |
boolean |
contains(String logOutput) |
String |
getMessage(int position) |
void |
record(LogRule.LogLevel level) |
void |
recordLoggingForType(Class<?> type) |
int |
size() |
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement statement,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulepublic void record(LogRule.LogLevel level)
level - the log level to capturepublic void recordLoggingForType(Class<?> type)
type - the logging class type for which to capture logspublic boolean contains(String logOutput)
logOutput - the log output to match in the captured datapublic String getMessage(int position)
position - the message number in the list of captured logspublic int size()
Copyright © 2004–2016 XWiki. All rights reserved.