Class DisallowWriteToSystemErr
java.lang.Object
org.junit.contrib.java.lang.system.DisallowWriteToSystemErr
- All Implemented Interfaces:
org.junit.rules.TestRule
DisallowWriteToSystemErr
lets a test fail if it tries to write
something to System.err
.
For that purpose you only have to add DisallowWriteToSystemErr
rule to your test class
public class TestClass { @Rule public final DisallowWriteToSystemErr disallowWriteToSystemErr = new DisallowWriteToSystemErr(); @Test public void this_test_fails() { System.err.println("some text"); } }
- Since:
- 1.14.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description)
-
Field Details
-
disallowWrite
-
-
Constructor Details
-
DisallowWriteToSystemErr
public DisallowWriteToSystemErr()
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
-