### Question:
ConsumerGroupCheckServiceImpl implements RedundanceCheckService { @Override public String checkResult() { String result = null; Map<String, ConsumerGroupEntity> consumerGroupMap = consumerGroupService.getCache(); Map<String, ConsumerGroupTopicEntity> consumerGroupTopicMap = consumerGroupTopicService.getGroupTopic(); Map<String,TopicEntity> topicMap=topicService.getCache(); result = checkConsumerGroup(consumerGroupMap, consumerGroupTopicMap,topicMap); return result; }  @Override String checkItem(); @Override String checkResult(); String checkConsumerGroup(Map<String, ConsumerGroupEntity> consumerGroupMap, Map<String, ConsumerGroupTopicEntity> consumerGroupTopicMap,
                                     Map<String,TopicEntity> topicMap);  }### Answer:
@Test public void checkResultTest() { Map<String, ConsumerGroupEntity> consumerGroupMap = new HashMap<>(); ConsumerGroupEntity consumerGroupEntity=new ConsumerGroupEntity(); consumerGroupEntity.setName("test"); consumerGroupEntity.setOriginName("test1"); consumerGroupEntity.setTopicNames("test"); consumerGroupEntity.setIpBlackList("1"); consumerGroupEntity.setIpWhiteList("2"); consumerGroupEntity.setMode(1); consumerGroupEntity.setConsumerQuality(-1); consumerGroupMap.put(consumerGroupEntity.getName(), consumerGroupEntity); when(consumerGroupService.getCache()).thenReturn(consumerGroupMap); Map<String, ConsumerGroupTopicEntity> consumerGroupTopicMap = new HashMap<>(); ConsumerGroupTopicEntity consumerGroupTopicEntity=new ConsumerGroupTopicEntity(); consumerGroupTopicEntity.setConsumerGroupName(consumerGroupEntity.getName()); consumerGroupTopicEntity.setTopicName(consumerGroupEntity.getTopicNames()); consumerGroupTopicMap.put("1", consumerGroupTopicEntity); when(consumerGroupTopicService.getGroupTopic()).thenReturn(consumerGroupTopicMap); Map<String,TopicEntity> topicMap=new HashMap<>(); when(topicService.getCache()).thenReturn(topicMap); assertEquals(5, search(consumerGroupCheckServiceImpl.checkResult(),"<br/>")); }
@Test public void checkResult1Test() { Map<String, ConsumerGroupEntity> consumerGroupMap = new HashMap<>(); ConsumerGroupEntity consumerGroupEntity=new ConsumerGroupEntity(); consumerGroupEntity.setName("test"); consumerGroupEntity.setOriginName("test1"); consumerGroupEntity.setTopicNames("test"); consumerGroupEntity.setIpBlackList("1"); consumerGroupEntity.setIpWhiteList("2"); consumerGroupEntity.setMode(2); consumerGroupEntity.setConsumerQuality(-1); consumerGroupMap.put(consumerGroupEntity.getName(), consumerGroupEntity); consumerGroupEntity=new ConsumerGroupEntity(); consumerGroupEntity.setName("Test"); consumerGroupEntity.setOriginName("test1"); consumerGroupEntity.setTopicNames("test"); consumerGroupEntity.setIpBlackList("1"); consumerGroupEntity.setIpWhiteList("2"); consumerGroupEntity.setMode(2); consumerGroupEntity.setConsumerQuality(-1); consumerGroupMap.put(consumerGroupEntity.getName(), consumerGroupEntity); when(consumerGroupService.getCache()).thenReturn(consumerGroupMap); Map<String, ConsumerGroupTopicEntity> consumerGroupTopicMap = new HashMap<>(); ConsumerGroupTopicEntity consumerGroupTopicEntity=new ConsumerGroupTopicEntity(); consumerGroupTopicEntity.setConsumerGroupName(consumerGroupEntity.getName()); consumerGroupTopicEntity.setTopicName(consumerGroupEntity.getTopicNames()); consumerGroupTopicMap.put("1", consumerGroupTopicEntity); when(consumerGroupTopicService.getGroupTopic()).thenReturn(consumerGroupTopicMap); Map<String,TopicEntity> topicMap=new HashMap<>(); when(topicService.getCache()).thenReturn(topicMap); assertEquals(11, search(consumerGroupCheckServiceImpl.checkResult(),"<br/>")); }