public class OutputCapture extends Object implements org.junit.rules.TestRule
@Rule
to capture output from System.out and System.err.Constructor and Description |
---|
OutputCapture() |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
protected void |
captureOutput() |
void |
expect(org.hamcrest.Matcher<? super String> matcher)
Verify that the output is matched by the supplied
matcher . |
void |
flush() |
protected void |
releaseOutput() |
void |
reset()
Discard all currently accumulated output.
|
String |
toString() |
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
protected void captureOutput()
protected void releaseOutput()
public void reset()
public void flush()
public void expect(org.hamcrest.Matcher<? super String> matcher)
matcher
. Verification is
performed after the test method has executed.matcher
- the matcherCopyright © 2018 Pivotal Software, Inc.. All rights reserved.