### Question:
ConsumerGroupServiceImpl extends AbstractBaseService<ConsumerGroupEntity> implements CacheUpdateService, ConsumerGroupService, TimerService { @Override public ConsumerGroupTopicEntity getTopic(String consumerGroupName, String topicName) { Map<String, ConsumerGroupEntity> cache = getCache(); if (!cache.containsKey(consumerGroupName)) { return null; } if (!consumerGroupTopicService.getCache().containsKey(cache.get(consumerGroupName).getId())) { return null; } return consumerGroupTopicService.getCache().get(cache.get(consumerGroupName).getId()).get(topicName); }  @Override void start(); @Override void updateCache(); @Override void forceUpdateCache(); @Override List<ConsumerGroupEntity> getLastMetaConsumerGroup(long minMessageId, long maxMessageId); @Override List<ConsumerGroupEntity> getLastRbConsumerGroup(long minMessageId, long maxMessageId); @Override // @Transactional(rollbackFor = Exception.class) void rb(List<QueueOffsetEntity> queueOffsetEntities); @Override void notifyRb(long id); @Override void notifyRb(List<Long> ids); @Override void notifyMeta(long id); @Override void notifyMeta(List<Long> ids); @Override Map<String, ConsumerGroupEntity> getByNames(List<String> names); @Override Map<String, ConsumerGroupEntity> getCache(); @Override Map<Long, ConsumerGroupEntity> getIdCache(); @Override List<String> getSubEnvList(); @Override void notifyOffset(long id); @Override List<ConsumerGroupTopicEntity> getGroupTopic(); @Override ConsumerGroupTopicEntity getTopic(String consumerGroupName, String topicName); @PreDestroy @Override void stop(); @Override List<ConsumerGroupEntity> getByOwnerNames(Map<String, Object> parameterMap); @Override long countByOwnerNames(Map<String, Object> parameterMap); @Override String info(); @Override void notifyRbByNames(List<String> consumerGroupNames); @Override String getCacheJson(); @Override ConsumerGroupCreateResponse createConsumerGroup(ConsumerGroupCreateRequest consumerGroupCreateRequest); @Override ConsumerGroupEditResponse editConsumerGroup(ConsumerGroupEntity consumerGroupEntity); @Override ConsumerGroupDeleteResponse deleteConsumerGroup(long consumerGroupId, boolean checkOnline); @Override BaseUiResponse<Void> addTopicNameToConsumerGroup(ConsumerGroupTopicEntity consumerGroupTopicEntity); @Override BaseUiResponse<Void> deleteTopicNameFromConsumerGroup(ConsumerGroupTopicEntity consumerGroupTopicEntity); @Override @Transactional(rollbackFor = Exception.class, propagation= Propagation.NESTED) void copyAndNewConsumerGroup(ConsumerGroupEntity consumerGroupEntityOld,
			ConsumerGroupEntity consumerGroupEntityNew); @Override Map<String, ConsumerGroupEntity> getData();  }### Answer:
@Test public void getTopicTest() { Map<String, ConsumerGroupEntity> consumerGroupRefMap = new HashMap<String, ConsumerGroupEntity>(); consumerGroupRefMap.put("test", new ConsumerGroupEntity()); consumerGroupRefMap.get("test").setId(1L); consumerGroupServiceImpl.consumerGroupRefMap.set(consumerGroupRefMap); assertEquals(null, consumerGroupServiceImpl.getTopic("test1", "tet")); Map<Long, Map<String, ConsumerGroupTopicEntity>> cacheMap = new HashMap<Long, Map<String, ConsumerGroupTopicEntity>>(); Map<String, ConsumerGroupTopicEntity> dataMap = new HashMap<String, ConsumerGroupTopicEntity>(); dataMap.put("test", new ConsumerGroupTopicEntity()); cacheMap.put(1L, dataMap); when(consumerGroupTopicService.getCache()).thenReturn(cacheMap); consumerGroupRefMap = new HashMap<String, ConsumerGroupEntity>(); consumerGroupRefMap.put("test", new ConsumerGroupEntity()); consumerGroupRefMap.get("test").setId(2L); consumerGroupServiceImpl.consumerGroupRefMap.set(consumerGroupRefMap); assertEquals(null, consumerGroupServiceImpl.getTopic("test", "test")); consumerGroupRefMap = new HashMap<String, ConsumerGroupEntity>(); consumerGroupRefMap.put("test", new ConsumerGroupEntity()); consumerGroupRefMap.get("test").setId(1L); consumerGroupServiceImpl.consumerGroupRefMap.set(consumerGroupRefMap); assertEquals(true, consumerGroupServiceImpl.getTopic("test", "test") != null); }