public class DisallowWriteToSystemErr
extends java.lang.Object
implements 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"); } }
DisallowWriteToSystemOut
Modifier and Type | Field and Description |
---|---|
private DisallowWrite |
disallowWrite |
Constructor and Description |
---|
DisallowWriteToSystemErr() |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
private final DisallowWrite disallowWrite