April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Example
n// This class tests a lot of error conditions, which
n// Xalan annoyingly logs to System.err.This hides System.err
n// before each test and restores it after each test.
n
nprivate PrintStream systemErr;
n
n@BeforeClass protected void redirectStderr() {
n  systemErr = System.err; // Hold on to the original value
n  System.setErr(new PrintStream(new ByteArrayOutputStream()));
n}
n
n@AfterClass protected void tearDown() {
n  // restore the original value
n  System.setErr(systemErr);
n}
n