builder.addEventListener(ConfigurationErrorEvent.ANY, l3);
BasicConfigurationBuilder<XMLConfiguration> builder2 =
new BasicConfigurationBuilder<XMLConfiguration>(
XMLConfiguration.class);
builder.copyEventListeners(builder2);
XMLConfiguration config = builder2.getConfiguration();
Collection<EventListener<? super ConfigurationEvent>> listeners =
config.getEventListeners(ConfigurationEvent.ANY);
assertEquals("Wrong number of listeners", 1, listeners.size());
assertTrue("Wrong listener", listeners.contains(l1));
listeners =
config.getEventListeners(ConfigurationEvent.ANY_HIERARCHICAL);
assertEquals("Wrong number of listeners for hierarchical", 2,
listeners.size());
assertTrue("Listener 1 not found", listeners.contains(l1));
assertTrue("Listener 2 not found", listeners.contains(l2));
Collection<EventListener<? super ConfigurationErrorEvent>> errListeners =
config.getEventListeners(ConfigurationErrorEvent.ANY);
assertEquals("Wrong number of error listeners", 1, errListeners.size());
assertTrue("Wrong error listener", errListeners.contains(l3));
}