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",
forRemoval=true)
public class OutputCaptureRule
extends Object
implements org.junit.rules.TestRule, CapturedOutput
Deprecated, for removal: This API element is subject to removal in a future version.
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
- Author:
- Phillip Webb, Andy Wilkinson
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) Deprecated, for removal: This API element is subject to removal in a future version.void
Deprecated, for removal: This API element is subject to removal in a future version.Verify that the output is matched by the suppliedmatcher
.getAll()
Deprecated, for removal: This API element is subject to removal in a future version.Return all content (bothSystem.out
andSystem.err
) in the order that it was captured.getErr()
Deprecated, for removal: This API element is subject to removal in a future version.ReturnSystem.err
content in the order that it was captured.getOut()
Deprecated, for removal: This API element is subject to removal in a future version.ReturnSystem.out
content in the order that it was captured.toString()
Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.boot.test.system.CapturedOutput
charAt, length, subSequence
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
OutputCaptureRule
public OutputCaptureRule()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
apply
in interfaceorg.junit.rules.TestRule
-
getAll
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:CapturedOutput
Return all content (bothSystem.out
andSystem.err
) in the order that it was captured.- Specified by:
getAll
in interfaceCapturedOutput
- Returns:
- all captured output
-
getOut
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:CapturedOutput
ReturnSystem.out
content in the order that it was captured.- Specified by:
getOut
in interfaceCapturedOutput
- Returns:
System.out
captured output
-
getErr
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:CapturedOutput
ReturnSystem.err
content in the order that it was captured.- Specified by:
getErr
in interfaceCapturedOutput
- Returns:
System.err
captured output
-
toString
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
expect
Deprecated, for removal: This API element is subject to removal in a future version.Verify that the output is matched by the suppliedmatcher
. Verification is performed after the test method has executed.- Parameters:
matcher
- the matcher
-
OutputCaptureExtension