### Question:
AbortedOperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { Instant instant = Instant.now() .minus(30, ChronoUnit.MINUTES); List<HistoricOperationEvent> abortedOperations = historicOperationEventService.createQuery() .type(HistoricOperationEvent.EventType.ABORTED) .olderThan(new Date(instant.toEpochMilli())) .list(); abortedOperations.stream() .map(HistoricOperationEvent::getProcessId) .distinct() .filter(this::isInActiveState) .forEach(this::deleteProcessInstance); } @Inject  AbortedOperationsCleaner(HistoricOperationEventService historicOperationEventService, FlowableFacade flowableFacade); @Override void execute(Date expirationTime);  }### Answer:
@Test void testExecuteWithNoAbortedOperations() { prepareMocksWithProcesses(Collections.emptyList()); abortedOperationsCleaner.execute(new Date()); Mockito.verify(historicOperationEventService) .createQuery(); Mockito.verifyNoInteractions(flowableFacade); }
@Test void testExecute() { prepareMocksWithProcesses(List.of(new CustomProcess("foo", true), new CustomProcess("bar", true))); abortedOperationsCleaner.execute(new Date()); Mockito.verify(flowableFacade, Mockito.times(2)) .getProcessInstance(anyString()); Mockito.verify(flowableFacade) .deleteProcessInstance("foo", Operation.State.ABORTED.name()); Mockito.verify(flowableFacade) .deleteProcessInstance("bar", Operation.State.ABORTED.name()); }