Class OutputCaptureRule
java.lang.Object
org.springframework.boot.test.system.OutputCaptureRule
- All Implemented Interfaces:
CharSequence, TestRule, CapturedOutput
@Deprecated(since="4.0.0",
forRemoval=true)
public class OutputCaptureRule
extends Object
implements 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 TypeMethodDescriptionapply(Statement base, Description description) Deprecated, for removal: This API element is subject to removal in a future version.voidDeprecated, 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.outandSystem.err) in the order that it was captured.getErr()Deprecated, for removal: This API element is subject to removal in a future version.ReturnSystem.errcontent in the order that it was captured.getOut()Deprecated, for removal: This API element is subject to removal in a future version.ReturnSystem.outcontent 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CapturedOutput
charAt, length, subSequenceMethods inherited from interface CharSequence
chars, codePoints, getChars, isEmpty
-
Constructor Details
-
OutputCaptureRule
public OutputCaptureRule()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
apply
Deprecated, for removal: This API element is subject to removal in a future version. -
getAll
Deprecated, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.Description copied from interface:CapturedOutputReturnSystem.outcontent in the order that it was captured.- Specified by:
getOutin interfaceCapturedOutput- Returns:
System.outcaptured output
-
getErr
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:CapturedOutputReturnSystem.errcontent in the order that it was captured.- Specified by:
getErrin interfaceCapturedOutput- Returns:
System.errcaptured output
-
toString
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
expect
-
OutputCaptureExtension