SignalReceivedListenerDelegate implements ActivitiEventListener { @Override public void onEvent(ActivitiEvent event) { if (event instanceof ActivitiSignalEvent) { converter.from((ActivitiSignalEvent) event) .ifPresent(convertedEvent -> { for (BPMNElementEventListener<BPMNSignalReceivedEvent> listener : processRuntimeEventListeners) { listener.onEvent(convertedEvent); } }); } } SignalReceivedListenerDelegate(List<BPMNElementEventListener<BPMNSignalReceivedEvent>> processRuntimeEventListeners,
                                            ToSignalReceivedConverter converter); @Override void onEvent(ActivitiEvent event); @Override boolean isFailOnException();  }
@Test public void onEventShouldCallOnAvailableListenersWhenIsASignalEvent() { ActivitiSignalEventImpl internalEvent = new ActivitiSignalEventImpl(ActivitiEventType.ACTIVITY_SIGNALED); BPMNSignalReceivedEventImpl signalReceivedEvent = new BPMNSignalReceivedEventImpl(); given(converter.from(internalEvent)).willReturn(Optional.of(signalReceivedEvent)); listenerDelegate.onEvent(internalEvent); verify(firstListener).onEvent(signalReceivedEvent); verify(secondListener).onEvent(signalReceivedEvent); }