public class LogVerifier
extends org.junit.rules.Verifier
Rule
annotation which provides a MavenLogger
instance and performs assertions on the log entries written to that logger. By default, it is
expected that no errors are logged. The expectations can be modified (per test) by calling the
expect
methods on this instance.Modifier and Type | Class and Description |
---|---|
private class |
LogVerifier.MemoryLog |
private class |
LogVerifier.TestRunContext |
Modifier and Type | Field and Description |
---|---|
private LogVerifier.TestRunContext |
currentContext |
private static boolean |
WRITE_TO_CONSOLE |
Constructor and Description |
---|
LogVerifier() |
Modifier and Type | Method and Description |
---|---|
void |
expectError(org.hamcrest.Matcher<java.lang.String> matcher)
Verify that the logged errors match the given matcher.
|
void |
expectError(java.lang.String string)
Verify that the logged errors contain the given string.
|
void |
expectInfo(org.hamcrest.Matcher<java.lang.String> matcher)
Verify that the info output match the given matcher.
|
void |
expectInfo(java.lang.String string)
Verify that the info output contain the given string.
|
void |
expectNoWarnings()
Fails the test if warnings were logged.
|
void |
expectWarning(org.hamcrest.Matcher<java.lang.String> matcher)
Verify that the logged warnings match the given matcher.
|
void |
expectWarning(java.lang.String string)
Verify that the logged warnings contain the given string.
|
private LogVerifier.TestRunContext |
getInitializedContext() |
MavenLogger |
getLogger() |
protected void |
verify() |
private static boolean WRITE_TO_CONSOLE
private LogVerifier.TestRunContext currentContext
private LogVerifier.TestRunContext getInitializedContext()
public MavenLogger getLogger()
public void expectError(java.lang.String string)
public void expectError(org.hamcrest.Matcher<java.lang.String> matcher)
public void expectWarning(java.lang.String string)
public void expectWarning(org.hamcrest.Matcher<java.lang.String> matcher)
public void expectNoWarnings()
public void expectInfo(java.lang.String string)
public void expectInfo(org.hamcrest.Matcher<java.lang.String> matcher)
protected void verify() throws java.lang.Throwable
verify
in class org.junit.rules.Verifier
java.lang.Throwable