### Question:
FlowService { public FlowCheckResponse getFlowState(String flowId) { List<FlowLog> allByFlowIdOrderByCreatedDesc = flowLogDBService.findAllByFlowIdOrderByCreatedDesc(flowId); FlowCheckResponse flowCheckResponse = new FlowCheckResponse(); flowCheckResponse.setFlowId(flowId); flowCheckResponse.setHasActiveFlow(!completed("Flow", flowId, List.of(), allByFlowIdOrderByCreatedDesc)); return flowCheckResponse; }  FlowLogResponse getLastFlowById(String flowId); List<FlowLogResponse> getFlowLogsByFlowId(String flowId); FlowLogResponse getLastFlowByResourceName(String resourceName); FlowLogResponse getLastFlowByResourceCrn(String resourceCrn); List<FlowLogResponse> getFlowLogsByResourceCrn(String resourceCrn); List<FlowLogResponse> getFlowLogsByResourceName(String resourceName); FlowCheckResponse getFlowChainStateByResourceCrn(String chainId, String resourceCrn); FlowCheckResponse getFlowChainState(String chainId); FlowCheckResponse getFlowChainStateSafe(Long resourceId, String chainId); FlowCheckResponse getFlowState(String flowId);  }### Answer:
@Test public void testHasFlowRunningByFlowId() { setUpFlow(FLOW_ID, List.of( pendingFlowLog(INTERMEDIATE_STATE, NEXT_EVENT, 2), flowLog(FlowConstants.INIT_STATE, NEXT_EVENT, 1) )); FlowCheckResponse flowCheckResponse = underTest.getFlowState(FLOW_ID); assertTrue(flowCheckResponse.getHasActiveFlow()); assertNotNull(flowCheckResponse.getFlowId()); verify(flowLogDBService).findAllByFlowIdOrderByCreatedDesc(anyString()); verifyZeroInteractions(flowChainLogService); }
@Test public void testNoFlowRunningByFlowId() { setUpFlow(FLOW_ID, List.of( flowLog(FlowConstants.FINISHED_STATE, NO_NEXT_EVENT, 2), flowLog(FlowConstants.INIT_STATE, NEXT_EVENT, 1) )); FlowCheckResponse flowCheckResponse = underTest.getFlowState(FLOW_ID); assertFalse(flowCheckResponse.getHasActiveFlow()); assertNotNull(flowCheckResponse.getFlowId()); verify(flowLogDBService).findAllByFlowIdOrderByCreatedDesc(anyString()); verify(flowChainLogService).hasEventInFlowChainQueue(List.of()); }