public void testPublish_AfterClose() throws Exception {
Properties p = new Properties();
p.put("java.util.logging.StreamHandler.level", "FINE");
LogManager.getLogManager().readConfiguration(
EnvironmentHelper.PropertiesToInputStream(p));
ByteArrayOutputStream aos = new ByteArrayOutputStream();
StreamHandler h = new StreamHandler(aos, new MockFormatter());
assertSame(h.getLevel(), Level.FINE);
LogRecord r = new LogRecord(Level.INFO, "testPublish_NoFormatter");
assertTrue(h.isLoggable(r));
h.close();
assertFalse(h.isLoggable(r));
h.publish(r);
h.flush();
assertEquals("MockFormatter_HeadMockFormatter_Tail", aos.toString());
}
StreamHandlerTest.java 文件源码
java
阅读 37
收藏 0
点赞 0
评论 0
项目:cn1
作者:
评论列表
文章目录