LogTestpublic class LogTest extends Object
Fields Summary |
---|
private MockLog | mLog |
Methods Summary |
---|
public void | setUp()
mLog = new MockLog();
| public void | tearDown()
// pass
| public void | testDebug()
assertEquals("", mLog.getOut());
assertEquals("", mLog.getErr());
mLog.setVerbose(false);
mLog.debug("Test %d", 42);
assertEquals("", mLog.getOut());
mLog.setVerbose(true);
mLog.debug("Test %d", 42);
assertEquals("Test 42\n", mLog.getOut());
assertEquals("", mLog.getErr());
| public void | testError()
assertEquals("", mLog.getOut());
assertEquals("", mLog.getErr());
mLog.error("Test %d", 44);
assertEquals("", mLog.getOut());
assertEquals("Test 44\n", mLog.getErr());
| public void | testException()
assertEquals("", mLog.getOut());
assertEquals("", mLog.getErr());
Exception e = new Exception("My Exception");
mLog.exception(e, "Test %d", 44);
assertEquals("", mLog.getOut());
assertTrue(mLog.getErr().startsWith("Test 44\njava.lang.Exception: My Exception"));
| public void | testInfo()
assertEquals("", mLog.getOut());
assertEquals("", mLog.getErr());
mLog.info("Test %d", 43);
assertEquals("Test 43\n", mLog.getOut());
assertEquals("", mLog.getErr());
|
|