use of org.sonatype.aether.RepositoryListener in project sonatype-aether by sonatype.
the class DefaultRepositoryEventDispatcherTest method testDispatchHandlesAllEventTypes.
@Test
public void testDispatchHandlesAllEventTypes() throws Exception {
DefaultRepositoryEventDispatcher dispatcher = new DefaultRepositoryEventDispatcher();
ListenerHandler handler = new ListenerHandler();
RepositoryListener listener = (RepositoryListener) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[] { RepositoryListener.class }, handler);
TestRepositorySystemSession session = new TestRepositorySystemSession();
session.setRepositoryListener(listener);
for (RepositoryEvent.EventType type : RepositoryEvent.EventType.values()) {
DefaultRepositoryEvent event = new DefaultRepositoryEvent(type, session, null);
handler.methodName = null;
dispatcher.dispatch(event);
assertNotNull("not handled: " + type, handler.methodName);
assertEquals("badly handled: " + type, type.name().replace("_", "").toLowerCase(Locale.ENGLISH), handler.methodName.toLowerCase(Locale.ENGLISH));
}
}
Aggregations