public class ConsoleRedirectRule extends Object implements org.junit.rules.TestRule
ConsoleRedirectRule.
public class YourTest{
Rule
private ConsoleRedirectRule consoleRedirectRule = ConsoleRedirectRule.instance();
public void yourTestMethod(){
System.out.println("HalloWelt");
assertThat(consoleRedirectRule.getConsoleoutput(), is("HalloWelt"));
}
}
| Constructor and Description |
|---|
ConsoleRedirectRule() |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement baseStatement,
org.junit.runner.Description description) |
String |
getOutput() |
static ConsoleRedirectRule |
instance() |
public static ConsoleRedirectRule instance()
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement baseStatement,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulepublic String getOutput()
Copyright © 2016. All rights reserved.