Class OutputCaptureRule
java.lang.Object
org.springframework.boot.test.system.OutputCaptureRule
- All Implemented Interfaces:
CharSequence,org.junit.rules.TestRule,CapturedOutput
@Deprecated(since="4.0.0")
public class OutputCaptureRule
extends Object
implements org.junit.rules.TestRule, CapturedOutput
Deprecated.
JUnit
@Rule to capture output from System.out and System.err.
To use add as a @Rule:
public class MyTest {
@Rule
public OutputCaptureRule output = new OutputCaptureRule();
@Test
public void test() {
assertThat(output).contains("ok");
}
}
- Since:
- 2.2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description) Deprecated.voidDeprecated.Verify that the output is matched by the suppliedmatcher.getAll()Deprecated.Return all content (bothSystem.outandSystem.err) in the order that it was captured.getErr()Deprecated.ReturnSystem.errcontent in the order that it was captured.getOut()Deprecated.ReturnSystem.outcontent in the order that it was captured.toString()Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.boot.test.system.CapturedOutput
charAt, length, subSequenceMethods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
OutputCaptureRule
public OutputCaptureRule()Deprecated.
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) Deprecated.- Specified by:
applyin interfaceorg.junit.rules.TestRule
-
getAll
Deprecated.Description copied from interface:CapturedOutputReturn all content (bothSystem.outandSystem.err) in the order that it was captured.- Specified by:
getAllin interfaceCapturedOutput- Returns:
- all captured output
-
getOut
Deprecated.Description copied from interface:CapturedOutputReturnSystem.outcontent in the order that it was captured.- Specified by:
getOutin interfaceCapturedOutput- Returns:
System.outcaptured output
-
getErr
Deprecated.Description copied from interface:CapturedOutputReturnSystem.errcontent in the order that it was captured.- Specified by:
getErrin interfaceCapturedOutput- Returns:
System.errcaptured output
-
toString
Deprecated.- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
expect
Deprecated.Verify that the output is matched by the suppliedmatcher. Verification is performed after the test method has executed.- Parameters:
matcher- the matcher
-
OutputCaptureExtension