### Question:
ConsumerGroupTopicServiceImpl extends AbstractBaseService<ConsumerGroupTopicEntity> implements CacheUpdateService, ConsumerGroupTopicService, TimerService { @Override public void forceUpdateCache() { Transaction transaction = Tracer.newTransaction("Timer", "ConsumerGroupTopic-updateCache"); TraceMessageItem traceMessageItem = new TraceMessageItem(); try { List<ConsumerGroupTopicEntity> consumerGroupEntities = getList(); MqReadMap<Long, Map<String, ConsumerGroupTopicEntity>> dataMap = new MqReadMap<>(consumerGroupEntities.size()/3); MqReadMap<String, ConsumerGroupTopicEntity> groupTopicMap = new MqReadMap<>(consumerGroupEntities.size()); MqReadMap<String, List<ConsumerGroupTopicEntity>> topicSubscribeMap = new MqReadMap<>(consumerGroupEntities.size()); consumerGroupEntities.forEach(t1 -> { if (!dataMap.containsKey(t1.getConsumerGroupId())) { dataMap.put(t1.getConsumerGroupId(), new HashMap<>()); } dataMap.get(t1.getConsumerGroupId()).put(t1.getTopicName(), t1); if (!groupTopicMap.containsKey(t1.getConsumerGroupName() + "_" + t1.getTopicName())) { groupTopicMap.put(t1.getConsumerGroupName() + "_" + t1.getTopicName(), t1); } if(!topicSubscribeMap.containsKey(t1.getTopicName())){ topicSubscribeMap.put(t1.getTopicName(),new ArrayList<>()); } topicSubscribeMap.get(t1.getTopicName()).add(t1); }); dataMap.setOnlyRead(); groupTopicMap.setOnlyRead(); consumerGroupTopicRefMap.set(dataMap); groupTopicRefMap.set(groupTopicMap); topicSubscribeRefMap.set(topicSubscribeMap); traceMessageItem.status = "count-" + groupTopicMap.size(); consumerGroupTopicCacheTrace.add(traceMessageItem); transaction.setStatus(Transaction.SUCCESS); } catch (Exception e) { transaction.setStatus(e); lastUpdateEntity = null; } finally { transaction.complete(); } }  @Override void start(); @Override void updateCache(); @Override void forceUpdateCache(); @Override Map<Long, Map<String, ConsumerGroupTopicEntity>> getCache(); @Override Map<String, ConsumerGroupTopicEntity> getGroupTopic(); @Override void deleteByConsumerGroupId(long consumerGroupId); @Override void deleteByOriginTopicName(long consumerGroupId, String originTopicName); @Override List<String> getFailTopicNames(long consumerGroupId); @Override ConsumerGroupTopicEntity getCorrespondConsumerGroupTopic(Map<String, Object> parameterMap); @Override void updateEmailByGroupName(String groupName, String alarmEmails); @PreDestroy @Override void stop(); @Override String info(); @Override String getCacheJson(); @Override Map<String, List<ConsumerGroupTopicEntity>> getTopicSubscribeMap(); @Transactional(rollbackFor = Exception.class) @Override ConsumerGroupTopicCreateResponse subscribe(ConsumerGroupTopicCreateRequest consumerGroupTopicCreateRequest); @Override ConsumerGroupTopicCreateResponse subscribe(ConsumerGroupTopicCreateRequest consumerGroupTopicCreateRequest,Map<String, ConsumerGroupEntity> consumerGroupMap); @Override ConsumerGroupTopicEntity createConsumerGroupTopic(
			ConsumerGroupTopicCreateRequest consumerGroupTopicCreateRequest); @Transactional(rollbackFor = Exception.class) @Override ConsumerGroupTopicDeleteResponse deleteConsumerGroupTopic(long consumerGroupTopicId);  }### Answer:
@Test public void forceUpdateCacheTest() { List<ConsumerGroupTopicEntity> consumerGroupEntities = new ArrayList<ConsumerGroupTopicEntity>(); ConsumerGroupTopicEntity consumerGroupEntity = new ConsumerGroupTopicEntity(); consumerGroupEntity.setConsumerGroupName("test"); consumerGroupEntity.setTopicName("test"); consumerGroupEntity.setId(1L); consumerGroupEntities.add(consumerGroupEntity); when(consumerGroupTopicRepository.getAll()).thenReturn(consumerGroupEntities); consumerGroupTopicServiceImpl.forceUpdateCache(); assertEquals(1, consumerGroupTopicServiceImpl.consumerGroupTopicRefMap.get().size()); consumerGroupTopicServiceImpl.lastUpdateEntity = new LastUpdateEntity(); doThrow(new RuntimeException("test")).when(consumerGroupTopicRepository).getAll(); consumerGroupTopicServiceImpl.forceUpdateCache(); assertEquals(null, consumerGroupTopicServiceImpl.lastUpdateEntity); }