Code example for ConsoleHandler

Methods: publishflush

0
		Properties p = new Properties();
		p.put("java.util.logging.ConsoleHandler.formatter", className
				+ "$MockFormatter"); 
		LogManager.getLogManager().readConfiguration(
				EnvironmentHelper.PropertiesToInputStream(p));
		ConsoleHandler h = new ConsoleHandler();
		LogRecord r = new LogRecord(Level.INFO, "");
		h.publish(r);
		h.flush();
		assertEquals("MockFormatter_Head", this.errSubstituteStream.toString());
	} 
 
	/* 
	 * Test publish(), a log record with null msg, having output stream 
	 */ 
	public void testPublish_NullMsg() throws Exception { 
		Properties p = new Properties();
		p.put("java.util.logging.ConsoleHandler.formatter", className
				+ "$MockFormatter"); 
		LogManager.getLogManager().readConfiguration(
Connect your IDE to all the code out there  Get Codota for Java