### Question:
ErrorProcessListener extends AbstractFlowableEngineEventListener { @Override protected void entityCreated(FlowableEngineEntityEvent event) { Object entity = event.getEntity(); if (entity instanceof DeadLetterJobEntity) { handleWithCorrelationId(event, () -> handle(event, (DeadLetterJobEntity) entity)); } } @Inject  ErrorProcessListener(OperationInErrorStateHandler eventHandler); @Override boolean isFailOnException();  }### Answer:
@Test void testEntityCreatedWithWrongEntityClass() { FlowableEngineEntityEvent engineEntityEvent = Mockito.mock(FlowableEngineEntityEvent.class); JobEntity job = Mockito.mock(JobEntity.class); Mockito.when(engineEntityEvent.getEntity()) .thenReturn(job); errorProcessListener.entityCreated(engineEntityEvent); Mockito.verifyNoInteractions(eventHandler); }
@Test void testEntityCreatedWithNoException() { FlowableEngineEntityEvent engineEntityEvent = Mockito.mock(FlowableEngineEntityEvent.class); DeadLetterJobEntity job = Mockito.mock(DeadLetterJobEntity.class); Mockito.when(engineEntityEvent.getEntity()) .thenReturn(job); errorProcessListener.entityCreated(engineEntityEvent); Mockito.verifyNoInteractions(eventHandler); }
@Test void testEntityCreated() { FlowableEngineEntityEvent engineEntityEvent = Mockito.mock(FlowableEngineEntityEvent.class); DeadLetterJobEntity job = Mockito.mock(DeadLetterJobEntity.class); Mockito.when(engineEntityEvent.getEntity()) .thenReturn(job); Mockito.when(job.getExceptionMessage()) .thenReturn(ERROR_MESSAGE); errorProcessListener.entityCreated(engineEntityEvent); Mockito.verify(eventHandler) .handle(engineEntityEvent, ERROR_MESSAGE); }