### Question:
FlowCancelService { public void cancelRunningFlows(Long resourceId) { LOGGER.info("Cancel running flow for id: [{}]", resourceId); Payload cancelEvent = () -> resourceId; reactor.notify(Flow2Handler.FLOW_CANCEL, eventFactory.createEventWithErrHandler(eventParameterFactory.createEventParameters(resourceId), cancelEvent)); }  void cancelRunningFlows(Long resourceId); void cancelFlowSilently(FlowLog flowLog); void cancelFlow(FlowLog flowLog); void cancelTooOldTerminationFlowForResource(Long stackId, String stackName);  }### Answer:
@Test public void testCancelRunningFlows() { Map<String, Object> parameters = Map.of(); when(eventParameterFactory.createEventParameters(1L)).thenReturn(parameters); when(eventFactory.createEventWithErrHandler(eq(parameters), any(Payload.class))) .thenAnswer(invocation -> { Payload payload = invocation.getArgument(1, Payload.class); Assert.assertEquals(Long.valueOf(1L), payload.getResourceId()); return new Event<>(payload); }); underTest.cancelRunningFlows(1L); verify(reactor, times(1)).notify(eq(Flow2Handler.FLOW_CANCEL), any(Event.class)); }