// Clear any events received (eg. engine initialisation)
listener.clearEventsReceived();
// Dispath a custom event
ActivitiEvent event = new ActivitiEventImpl(ActivitiEventType.CUSTOM);
processEngineConfiguration.getEventDispatcher().dispatchEvent(event);
assertEquals(1, listener.getEventsReceived().size());
assertEquals(event, listener.getEventsReceived().get(0));
listener.clearEventsReceived();
// Dispatch another event the listener is registered for
event = new ActivitiEventImpl(ActivitiEventType.ENTITY_DELETED);
processEngineConfiguration.getEventDispatcher().dispatchEvent(event);
event = new ActivitiEventImpl(ActivitiEventType.ENTITY_UPDATED);
processEngineConfiguration.getEventDispatcher().dispatchEvent(event);
assertEquals(2, listener.getEventsReceived().size());
assertEquals(ActivitiEventType.ENTITY_DELETED, listener.getEventsReceived().get(0).getType());
assertEquals(ActivitiEventType.ENTITY_UPDATED, listener.getEventsReceived().get(1).getType());
listener.clearEventsReceived();
// Dispatch an event that is NOT part of the types configured
event = new ActivitiEventImpl(ActivitiEventType.ENTITY_CREATED);
processEngineConfiguration.getEventDispatcher().dispatchEvent(event);
assertTrue(listener.getEventsReceived().isEmpty());
}