### Question:
OperationInErrorStateHandler { HistoricOperationEvent.EventType toEventType(Throwable throwable) { return hasCause(throwable, ContentException.class) ? HistoricOperationEvent.EventType.FAILED_BY_CONTENT_ERROR : HistoricOperationEvent.EventType.FAILED_BY_INFRASTRUCTURE_ERROR; } @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 testToEventType() { OperationInErrorStateHandler handler = mockHandler(); Throwable throwable = new RuntimeException(new SLException(new IOException())); HistoricOperationEvent.EventType eventType = handler.toEventType(throwable); assertEquals(HistoricOperationEvent.EventType.FAILED_BY_INFRASTRUCTURE_ERROR, eventType); }
@Test void testToEventTypeWithContentException() { OperationInErrorStateHandler handler = mockHandler(); Throwable throwable = new RuntimeException(new SLException(new IOException(new ParsingException("")))); HistoricOperationEvent.EventType eventType = handler.toEventType(throwable); assertEquals(HistoricOperationEvent.EventType.FAILED_BY_CONTENT_ERROR, eventType); }