Class StandardOutputStreamLog
java.lang.Object
org.junit.contrib.java.lang.system.StandardOutputStreamLog
- All Implemented Interfaces:
org.junit.rules.TestRule
Deprecated.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Please usenew SystemOutRule().enableLog()
.Deprecated.Please usenew SystemOutRule().enableLog()
instead ofnew StandardOutputStreamLog(LogMode.LOG_AND_WRITE_TO_STREAM)
ornew SystemOutRule().enableLog()
.mute()
instead ofnew StandardOutputStreamLog(LogMode.LOG_ONLY)
. -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) Deprecated.void
clear()
Deprecated.Please useSystemOutRule.clearLog()
.getLog()
Deprecated.Please useSystemOutRule.getLog()
.
-
Field Details
-
systemOut
Deprecated.
-
-
Constructor Details
-
StandardOutputStreamLog
public StandardOutputStreamLog()Deprecated.Please usenew SystemOutRule().enableLog()
.Creates a rule that records writes while they are still written to the standard output stream.
-
StandardOutputStreamLog
Deprecated.Please usenew SystemOutRule().enableLog()
instead ofnew StandardOutputStreamLog(LogMode.LOG_AND_WRITE_TO_STREAM)
ornew SystemOutRule().enableLog()
.mute()
instead ofnew StandardOutputStreamLog(LogMode.LOG_ONLY)
.Creates a rule that records writes to the standard output stream according to the specified
LogMode
.- Parameters:
mode
- how the rule handles writes to the standard output stream.- Throws:
NullPointerException
- ifmode
is null.
-
-
Method Details
-
clear
Deprecated.Please useSystemOutRule.clearLog()
.Clears the log. The log can be used again.
-
getLog
Deprecated.Please useSystemOutRule.getLog()
.Returns the text written to the standard output stream.
- Returns:
- the text written to the standard output stream.
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) Deprecated.- Specified by:
apply
in interfaceorg.junit.rules.TestRule
-
SystemOutRule
.The
You can clear the log if you only want to test parts of the text written to the standard output stream.StandardOutputStreamLog
records writes to the standard output stream. The text written is available viagetLog()
.Prevent output to the standard output stream
In general it is not necessary that a test writes to the standard output stream. Avoiding this output may speed up the test and reduce the clutter on the commandline.The test does not write to the stream if the rule is created with the
LogMode.LOG_ONLY
mode.