Methods Summary |
---|
public static void | main(java.lang.String[] args)
if (args.length == 0){
junit.textui.TestRunner.run(CLILoggerTest.class);
} else {
junit.textui.TestRunner.run(makeSuite(args));
}
|
private static junit.framework.TestSuite | makeSuite(java.lang.String[] args)
final TestSuite ts = new TestSuite();
for (int i = 0; i < args.length; i++){
ts.addTest(new CLILoggerTest(args[i]));
}
return ts;
|
private void | nyi()
fail("Not Yet Implemented");
|
protected void | setUp()
log.setOutputLevel(Level.INFO);
err = new ByteArrayOutputStream();
out = new ByteArrayOutputStream();
io = InputsAndOutputs.getInstance();
io.setErrorOutput(err);
io.setUserOutput(out);
|
protected void | tearDown()
|
public void | testBasicLogging()
log.printMessage(m);
assertEquals(m + ls, out.toString());
assertEquals("", err.toString());
|
public void | testErrorLogging()
log.printError(m);
assertEquals(m + ls, err.toString());
assertEquals("", out.toString());
|
public void | testLevelGetSet()
assertEquals(Level.INFO, log.getOutputLevel());
log.setOutputLevel(Level.SEVERE);
assertEquals(Level.SEVERE, log.getOutputLevel());
|
public void | testLevelsBlockOutput()
log.setOutputLevel(Level.SEVERE);
log.printMessage(m);
assertEquals("", out.toString());
assertEquals("", err.toString());
log.setOutputLevel(Level.INFO);
log.printMessage(m);
assertEquals(m + ls, out.toString());
assertEquals("", err.toString());
|
public void | testPrintDebugMessage()
log.setOutputLevel(Level.FINEST);
log.printDebugMessage(m);
assertEquals("", err.toString());
assertEquals(m + ls, out.toString());
|
public void | testPrintDetailMessage()
log.setOutputLevel(Level.FINEST);
log.printDetailMessage(m);
assertEquals(m + ls, out.toString());
assertEquals("", err.toString());
|
public void | testPrintExceptionStackTrace()
log.setOutputLevel(Level.FINEST);
final Throwable t = new Throwable(m);
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
log.printExceptionStackTrace(t);
assertEquals(sw.toString() + ls, out.toString());
assertEquals("", err.toString());
|
public void | testPrintWarning()
log.setOutputLevel(Level.FINEST);
log.printWarning(m);
assertEquals(m + ls, out.toString());
assertEquals("", err.toString());
|
public void | testSetLevelDoesntWorkUnderDebug()
assertEquals(Level.INFO, log.getOutputLevel());
System.setProperty("Debug", "on");
log.setOutputLevel(Level.SEVERE);
System.getProperties().remove("Debug");
assertTrue(Level.SEVERE != log.getOutputLevel());
assertEquals(Level.INFO, log.getOutputLevel());
|