forked from phoedos/pmd
Fix PMD CloseResource - BaseCLITest has actually setup/tearDown
which deals with restoring System.out/err already
This commit is contained in:
@ -107,20 +107,13 @@ public abstract class BaseCLITest {
|
||||
* Returns the log output.
|
||||
*/
|
||||
protected String runTest(int expectedExitCode, String... args) {
|
||||
PrintStream oldOut = System.out;
|
||||
PrintStream oldErr = System.err;
|
||||
try {
|
||||
ByteArrayOutputStream console = new ByteArrayOutputStream();
|
||||
PrintStream out = new PrintStream(console);
|
||||
System.setOut(out);
|
||||
System.setErr(out);
|
||||
StatusCode statusCode = PMD.runPmd(args);
|
||||
assertEquals(expectedExitCode, statusCode.toInt());
|
||||
return console.toString();
|
||||
} finally {
|
||||
System.setOut(oldOut);
|
||||
System.setOut(oldErr);
|
||||
}
|
||||
ByteArrayOutputStream console = new ByteArrayOutputStream();
|
||||
PrintStream out = new PrintStream(console);
|
||||
System.setOut(out);
|
||||
System.setErr(out);
|
||||
StatusCode statusCode = PMD.runPmd(args);
|
||||
assertEquals(expectedExitCode, statusCode.toInt());
|
||||
return console.toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
Reference in New Issue
Block a user