, , , , :
"logging" System.out.println() System.err.println(), , , stdout stderr .
// Save the original stdout and stderr
PrintStream psOut = System.out;
PrintStream psErr = System.err;
PrintStream psDevNull = null;
try
{
// Send stdout and stderr to /dev/null
psDevNull = new PrintStream(new ByteArrayOutputStream());
System.setOut(psDevNull);
System.setErr(psDevNull);
// run tests in loop
for (...)
{
}
}
finally
{
// Restore stdout and stderr
System.setOut(psOut);
System.setErr(psErr);
if (psDevNull != null)
{
psDevNull.close();
psDevNull = null;
}
}
, , JUnit , :
ant test &> /dev/null
Ant/JUnit, , , , , , , . , / System.out System.err , Ant JUnit.