### Question:
Logger implements LogProducer,Configurable { public void removeAllListeners () { for (Object l : listeners) { if (l instanceof Destroyable) { ((Destroyable) l).destroy(); } } listeners.clear (); } Logger(); Configuration getConfiguration(); @Override void setConfiguration(Configuration cfg); void addListener(LogListener l); void removeListener(LogListener l); void removeAllListeners(); static void log(LogEvent evt); void setName(String name); void destroy(); synchronized static Logger getLogger(String name); String getName(); boolean hasListeners(); static final String NRPREFIX; }### Answer:
@Test public void testRemoveAllListeners() throws Throwable { Logger logger = Logger.getLogger("testLoggerName"); LogListener l = new SimpleLogListener(); logger.addListener(l); logger.removeAllListeners(); assertEquals(0, logger.listeners.size(), "m_logger.listeners.size()"); assertFalse(logger.listeners.contains(l), "m_logger.listeners.contains(l)"); }
@Test public void testRemoveAllListeners3() throws Throwable { Logger logger = new Logger(); logger.removeAllListeners(); assertEquals(0, logger.listeners.size(), "m_logger.listeners.size()"); }