FileDocCategorySizeDatePackage
LogTest.javaAPI DocAndroid 1.5 API2895Wed May 06 22:42:02 BST 2009com.android.tools.layoutlib.create

LogTest

public class LogTest extends Object

Fields Summary
private MockLog
mLog
Constructors Summary
Methods Summary
public voidsetUp()

        mLog = new MockLog();
    
public voidtearDown()

        // pass
    
public voidtestDebug()

        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 voidtestError()

        assertEquals("", mLog.getOut());
        assertEquals("", mLog.getErr());

        mLog.error("Test %d", 44);

        assertEquals("", mLog.getOut());
        assertEquals("Test 44\n", mLog.getErr());
    
public voidtestException()

        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 voidtestInfo()

        assertEquals("", mLog.getOut());
        assertEquals("", mLog.getErr());

        mLog.info("Test %d", 43);

        assertEquals("Test 43\n", mLog.getOut());
        assertEquals("", mLog.getErr());