### Question:
ConsumerGroupTopicServiceImpl extends AbstractBaseService<ConsumerGroupTopicEntity> implements CacheUpdateService, ConsumerGroupTopicService, TimerService { protected boolean checkChanged() { boolean flag= doCheckChanged(); if(!flag){ if(System.currentTimeMillis()-lastTime>soaConfig.getMqMetaRebuildMaxInterval()){ lastTime=System.currentTimeMillis(); return true; } }else{ lastTime=System.currentTimeMillis(); } return flag; }  @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 checkChangedTest() { assertEquals(true, consumerGroupTopicServiceImpl.checkChanged()); LastUpdateEntity lastUpdateEntity = new LastUpdateEntity(); lastUpdateEntity.setCount(1); lastUpdateEntity.setMaxId(2L); when(consumerGroupTopicRepository.getLastUpdate()).thenReturn(lastUpdateEntity); assertEquals(true, consumerGroupTopicServiceImpl.checkChanged()); Map<Long, Map<String, ConsumerGroupTopicEntity>> map = new HashMap<Long, Map<String, ConsumerGroupTopicEntity>>(); map.put(1L, new HashMap<String, ConsumerGroupTopicEntity>()); consumerGroupTopicServiceImpl.consumerGroupTopicRefMap.set(map); assertEquals(false, consumerGroupTopicServiceImpl.checkChanged()); lastUpdateEntity = new LastUpdateEntity(); lastUpdateEntity.setCount(11); lastUpdateEntity.setMaxId(2L); consumerGroupTopicServiceImpl.lastUpdateEntity = lastUpdateEntity; assertEquals(true, consumerGroupTopicServiceImpl.checkChanged()); assertEquals(false, consumerGroupTopicServiceImpl.checkChanged()); doThrow(new RuntimeException("test")).when(consumerGroupTopicRepository).getLastUpdate(); assertEquals(false, consumerGroupTopicServiceImpl.checkChanged()); consumerGroupTopicServiceImpl.lastTime = System.currentTimeMillis() - soaConfig.getMqMetaRebuildMaxInterval() - 10; assertEquals(true, consumerGroupTopicServiceImpl.checkChanged()); }