Code example for LogRecord

0
 
public class OldLogRecordTest extends TestCase {
 
    static final String MSG = "test msg, pls. ignore itb";
 
    private LogRecord lr = new LogRecord(Level.CONFIG, MSG);
 
    public void testGetSetTimeCheck() { 
        long before = lr.getMillis();
        try { 
            Thread.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } 
        LogRecord lr2 = new LogRecord(Level.CONFIG, "MSG2");
        long after = lr2.getMillis();
        assertTrue(after-before>0);
    } 
 
    public void testGetSetLevelNormal() { 
        assertSame(lr.getLevel(), Level.CONFIG);