### Question:
OperationInErrorStateHandler { public void handle(FlowableEngineEvent event, String errorMessage) { handle(event, HistoricOperationEvent.EventType.FAILED_BY_INFRASTRUCTURE_ERROR, errorMessage); } @Inject  OperationInErrorStateHandler(ProgressMessageService progressMessageService, FlowableFacade flowableFacade,
                                        HistoricOperationEventService historicOperationEventService, ClientReleaser clientReleaser); void handle(FlowableEngineEvent event, String errorMessage); void handle(FlowableEngineEvent event, Throwable throwable);  }### Answer:
@Test void testWithErrorMessageAlreadyPersisted() { Mockito.when(flowableFacadeMock.getProcessInstanceId(Mockito.any())) .thenReturn("foo"); ProgressMessageQuery queryMock = new MockBuilder<>(progressMessageQuery).on(query -> query.processId("foo")) .build(); Mockito.doReturn(List.of(ImmutableProgressMessage.builder() .processId("foo") .taskId("") .text("") .type(ProgressMessageType.ERROR) .build())) .when(queryMock) .list(); FlowableEngineEvent event = Mockito.mock(FlowableEngineEvent.class); OperationInErrorStateHandler handler = mockHandler(); handler.handle(event, new Exception("test-message")); Mockito.verify(progressMessageServiceMock, Mockito.never()) .add(Mockito.any()); }