IndexCreatedHandler implements EventHandler { @Override public boolean handles(Class<?> eventClass) { return eventClass.equals(IndexCreatedEvent.class); } IndexCreatedHandler(IndexRepository indexRepo, IndexStatusRepository indexStatusRepo, DocumentRepository docRepo); @Override boolean handles(Class<?> eventClass); @Override void handle(Object event);  }
@Test public void testHandles() { System.out.println("handles"); Class eventClass = IndexCreatedEvent.class; IndexCreatedHandler instance = new IndexCreatedHandler(indexRepo, statusRepo, docRepo); boolean result = instance.handles(eventClass); assertEquals(true, result); Object o = new Object(); result = instance.handles(o.getClass()); assertEquals(false, result); }