### Question:
WorkFlowLineageService extends BaseService { public Map<String, Object> queryWorkFlowLineageByIds(Set<Integer> ids,int projectId) { Map<String, Object> result = new HashMap<>(5); List<WorkFlowLineage> workFlowLineageList = workFlowLineageMapper.queryByIds(ids, projectId); Map<String, Object> workFlowLists = new HashMap<>(5); Set<Integer> idsV = new HashSet<>(); if(ids == null || ids.isEmpty()){ for(WorkFlowLineage workFlowLineage:workFlowLineageList) { idsV.add(workFlowLineage.getWorkFlowId()); } } else { idsV = ids; } List<WorkFlowRelation> workFlowRelations = new ArrayList<>(); Set<Integer> sourceIds = new HashSet<>(); getWorkFlowRelationRecursion(idsV, workFlowRelations, sourceIds); Set<Integer> idSet = new HashSet<>(); if(ids != null && !ids.isEmpty()) { for(WorkFlowRelation workFlowRelation : workFlowRelations) { idSet.add(workFlowRelation.getTargetWorkFlowId()); } for(int id : ids){ idSet.remove(id); } if(!idSet.isEmpty()) { workFlowLineageList.addAll(workFlowLineageMapper.queryByIds(idSet, projectId)); } } workFlowLists.put("workFlowList",workFlowLineageList); workFlowLists.put("workFlowRelationList",workFlowRelations); result.put(Constants.DATA_LIST, workFlowLists); putMsg(result, Status.SUCCESS); return result; }  Map<String, Object> queryWorkFlowLineageByName(String workFlowName, int projectId); Map<String, Object> queryWorkFlowLineageByIds(Set<Integer> ids,int projectId);  }### Answer:
@Test public void testQueryWorkFlowLineageByIds() { Set<Integer> ids = new HashSet<>(); ids.add(1); ids.add(2); when(workFlowLineageMapper.queryByIds(ids, 1)).thenReturn(getWorkFlowLineages()); when(workFlowLineageMapper.querySourceTarget(1)).thenReturn(getWorkFlowRelation()); Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByIds(ids,1); Map<String, Object> workFlowLists = (Map<String, Object>)result.get(Constants.DATA_LIST); List<WorkFlowLineage> workFlowLineages = (List<WorkFlowLineage>)workFlowLists.get("workFlowList"); List<WorkFlowRelation> workFlowRelations = (List<WorkFlowRelation>)workFlowLists.get("workFlowRelationList"); Assert.assertTrue(workFlowLineages.size()>0); Assert.assertTrue(workFlowRelations.size()>0); }