Code example for LogRecord

Methods: getLevel, getLoggerName, getMessage, getParameters, getResourceBundleName, getSourceClassName, getSourceMethodName, getThrown

0
	/* 
	 * Test log(LogRecord) for a normal log record. Meanwhile the logger has an 
	 * appropriate level, a filter that accepts the fed log record, no parent. 
	 */ 
	public void testLog_LogRecord_AppropriateLevelTrueFilterNoParent() { 
		LogRecord r = new LogRecord(Level.INFO,
				"testLog_LogRecord_AppropriateLevelTrueFilterNoParent"); 
 
		this.sharedLogger.setLevel(Level.INFO);
		this.sharedLogger.setFilter(new MockTrueFilter());
		this.sharedLogger.log(r);
 
		// pop twice, one pushed by mock handler, one by true mock filter 
		assertSame(r, CallVerificationStack.getInstance().pop());
		assertSame(r, CallVerificationStack.getInstance().pop());
		assertTrue(CallVerificationStack.getInstance().empty());
 
		assertSame(r.getLoggerName(), null);
		assertEquals(r.getMessage(),
				"testLog_LogRecord_AppropriateLevelTrueFilterNoParent"); 
		assertSame(r.getResourceBundleName(), null);
		assertSame(r.getSourceClassName(), null);
		assertSame(r.getSourceMethodName(), null);
		assertSame(r.getLevel(), Level.INFO);
		assertNull(r.getParameters());
		assertSame(r.getThrown(), null);
	} 
 
	/* 
	 * Test log(LogRecord) for a normal log record. Meanwhile the logger has an 
	 * appropriate level, a filter that rejects the fed log record, no parent.