### Question:
ConsumerGroupTopicCheckServiceImpl implements RedundanceCheckService { @Override public String checkResult() { String result = null; Map<String,ConsumerGroupTopicEntity> consumerGroupTopicMap = consumerGroupTopicService.getGroupTopic(); Map<String,ConsumerGroupEntity> consumerGroupMap=consumerGroupService.getCache(); Map<String, TopicEntity> topicMap = topicService.getCache(); Map<String,QueueOffsetEntity> unQueueOffset=queueOffsetService.getUqCache(); result = checkConsumerGroupTopic(consumerGroupTopicMap,consumerGroupMap, topicMap,unQueueOffset); return result; }  @Override String checkItem(); @Override String checkResult(); String checkConsumerGroupTopic(Map<String,ConsumerGroupTopicEntity> consumerGroupTopicMap, Map<String,ConsumerGroupEntity> consumerGroupMap,
                                          Map<String, TopicEntity> topicMap,Map<String,QueueOffsetEntity> unQueueOffset);  }### Answer:
@Test public void checkResult1Test() { Map<String, ConsumerGroupTopicEntity> consumerGroupTopicMap = new HashMap<String, ConsumerGroupTopicEntity>(); ConsumerGroupTopicEntity consumerGroupTopicEntity=new ConsumerGroupTopicEntity(); consumerGroupTopicEntity.setConsumerGroupName("test"); consumerGroupTopicEntity.setTopicName("testTopic"); consumerGroupTopicEntity.setTopicType(1); consumerGroupTopicEntity.setRetryCount(-1); consumerGroupTopicEntity.setDelayProcessTime(-1); consumerGroupTopicEntity.setTimeOut(-1); consumerGroupTopicMap.put(consumerGroupTopicEntity.getConsumerGroupName() + "_" + consumerGroupTopicEntity.getTopicName(), consumerGroupTopicEntity); when(consumerGroupTopicService.getGroupTopic()).thenReturn(consumerGroupTopicMap); String rs=consumerGroupTopicCheckServiceImpl.checkResult(); assertEquals(9, search(rs, "<br/>")); }
@Test public void checkResult2Test() { Map<String, ConsumerGroupTopicEntity> consumerGroupTopicMap = new HashMap<String, ConsumerGroupTopicEntity>(); ConsumerGroupTopicEntity consumerGroupTopicEntity=new ConsumerGroupTopicEntity(); consumerGroupTopicEntity.setConsumerGroupName("test"); consumerGroupTopicEntity.setTopicName("testTopic"); consumerGroupTopicEntity.setTopicType(1); consumerGroupTopicEntity.setRetryCount(soaConfig.getConsumerGroupTopicMaxRetryCount()+1); consumerGroupTopicEntity.setThreadSize(soaConfig.getConsumerGroupTopicMaxThreadSize()+1); consumerGroupTopicEntity.setPullBatchSize(soaConfig.getMaxPullBatchSize()+1); consumerGroupTopicEntity.setDelayProcessTime(soaConfig.getMaxDelayProcessTime()+1); consumerGroupTopicEntity.setMaxPullTime(soaConfig.getMaxDelayPullTime()+1); consumerGroupTopicMap.put(consumerGroupTopicEntity.getConsumerGroupName() + "_" + consumerGroupTopicEntity.getTopicName(), consumerGroupTopicEntity); when(consumerGroupTopicService.getGroupTopic()).thenReturn(consumerGroupTopicMap); Map<String, ConsumerGroupEntity> consumerGroupMap = new HashMap<String, ConsumerGroupEntity>(); ConsumerGroupEntity consumerGroupEntity=new ConsumerGroupEntity(); consumerGroupEntity.setName("test"); consumerGroupEntity.setTopicNames("test"); consumerGroupMap.put(consumerGroupEntity.getName(), consumerGroupEntity); when(consumerGroupService.getCache()).thenReturn(consumerGroupMap); Map<String, TopicEntity> topicMap = new HashMap<String, TopicEntity>(); Map<String, QueueOffsetEntity> unQueueOffset = new HashMap<String, QueueOffsetEntity>(); unQueueOffset.put("fasf_fasf_dfasf", new QueueOffsetEntity()); when(queueOffsetService.getUqCache()).thenReturn(unQueueOffset); String rs=consumerGroupTopicCheckServiceImpl.checkResult(); assertEquals(9, search(rs, "<br/>")); }