// null target
try {
props.remove("java.util.logging.MemoryHandler.target");
manager.readConfiguration(EnvironmentHelper
.PropertiesToInputStream(props));
handler = new MemoryHandler();
fail("should throw RuntimeException: target must be set");
} catch (RuntimeException e) {
}
// invalid target
try {
props.put("java.util.logging.MemoryHandler.target", "badname");
manager.readConfiguration(EnvironmentHelper
.PropertiesToInputStream(props));
handler = new MemoryHandler();
fail("should throw RuntimeException: target must be valid");
} catch (RuntimeException e) {
}
// invalid formatter
initProps();
props.put("java.util.logging.MemoryHandler.formatter", "badname");
manager.readConfiguration(EnvironmentHelper
.PropertiesToInputStream(props));
handler = new MemoryHandler();
assertTrue(handler.getFormatter() instanceof SimpleFormatter);
// invalid level
initProps();
props.put("java.util.logging.MemoryHandler.level", "badname");
manager.readConfiguration(EnvironmentHelper
.PropertiesToInputStream(props));
handler = new MemoryHandler();
assertEquals(handler.getLevel(), Level.ALL);
// invalid pushlevel
initProps();
props.put("java.util.logging.MemoryHandler.push", "badname");
manager.readConfiguration(EnvironmentHelper
.PropertiesToInputStream(props));
handler = new MemoryHandler();
assertEquals(handler.getPushLevel(), Level.SEVERE);
// invalid filter
initProps();
props.put("java.util.logging.MemoryHandler.filter", "badname");
manager.readConfiguration(EnvironmentHelper
.PropertiesToInputStream(props));
handler = new MemoryHandler();
assertNull(handler.getFilter());
// invalid size
initProps();
props.put("java.util.logging.MemoryHandler.size", "-1");
manager.readConfiguration(EnvironmentHelper
.PropertiesToInputStream(props));
handler = new MemoryHandler();
initProps();
props.put("java.util.logging.MemoryHandler.size", "badsize");
manager.readConfiguration(EnvironmentHelper
.PropertiesToInputStream(props));
handler = new MemoryHandler();
}