org.junit.rules.TestRulepublic class DisallowWriteToSystemOut
extends java.lang.Object
implements org.junit.rules.TestRule
DisallowWriteToSystemOut lets a test fail if it tries to write
something to System.out.
For that purpose you only have to add DisallowWriteToSystemOut
rule to your test class
public class TestClass {
@Rule
public final DisallowWriteToSystemOut disallowWriteToSystemOut
= new DisallowWriteToSystemOut();
@Test
public void this_test_fails() {
System.out.println("some text");
}
}
DisallowWriteToSystemErr| Constructor | Description |
|---|---|
DisallowWriteToSystemOut() |
| Modifier and Type | Method | Description |
|---|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
Copyright © 2011–2018. All rights reserved.