EventProcessor implements EventPublisher<T> { public <E extends T> boolean processEvent(E event) { boolean consumed = false; if (!onEventConsumers.isEmpty()) { onEventConsumers.forEach(onEventConsumer -> onEventConsumer.consumeEvent(event)); consumed = true; } if (!eventConsumerMap.isEmpty()) { List<EventConsumer<T>> eventConsumers = this.eventConsumerMap .get(event.getClass().getSimpleName()); if (eventConsumers != null && !eventConsumers.isEmpty()) { eventConsumers.forEach(consumer -> consumer.consumeEvent(event)); consumed = true; } } return consumed; }  boolean hasConsumers(); @SuppressWarnings("unchecked") synchronized void registerConsumer(String className,
        EventConsumer<? extends T> eventConsumer); boolean processEvent(E event); @Override synchronized void onEvent(@Nullable EventConsumer<T> onEventConsumer);  }
@Test public void testNoConsumers() { EventProcessor<Number> eventProcessor = new EventProcessor<>(); boolean consumed = eventProcessor.processEvent(1); assertThat(consumed).isEqualTo(false); }