EventComponentImpl implements EventComponent { @Override public void onAny(Consumer<Event> action) { anyEventListeners.add(action); } EventComponentImpl(); @Override void notify(Event event); @Override @SuppressWarnings("unchecked") void on(Class<E> event, Consumer<E> action); @Override void on(DefaultEvent event, Consumer<DefaultEvent> action); @Override void onAny(Consumer<Event> action);  }
@Test void onAny() { final EventConsumer eventConsumer = new EventConsumer(); instance.onAny(eventConsumer); final List<Event> expected = Arrays.asList(new FooEvent(), new BarEvent()); expected.forEach(instance::notify); assertEquals(expected, eventConsumer.events()); }