use of com.graphaware.nlp.event.DefaultEvent in project neo4j-nlp by graphaware.
the class NLPExtensionTest method testExtensionCanRegisterEventListeners.
@Test
public void testExtensionCanRegisterEventListeners() {
Map<String, NLPExtension> loadedExtensions = ServiceLoader.loadInstances(NLPModuleExtension.class);
EventDispatcher dispatcher = new EventDispatcher();
loadedExtensions.values().forEach(nlpExtension -> {
nlpExtension.registerEventListeners(dispatcher);
});
dispatcher.notify(StubEvents.HELLO, new DefaultEvent("hello you"));
NLPExtension nlpExtension = loadedExtensions.get(StubExtension.class.getName());
assertEquals("hello you", ((StubExtension) nlpExtension).getSomeValue());
}
Aggregations