### Question:
DbNodeServiceImpl extends AbstractBaseService<DbNodeEntity> implements CacheUpdateService, DbNodeService, TimerService, PortalTimerService { protected boolean checkChanged() { Transaction transaction = Tracer.newTransaction("Timer", "DbNode-checkChanged"); boolean flag = false; try { LastUpdateEntity temp = dbNodeRepository.getLastUpdate(); if ((lastUpdateEntity == null && temp != null) || (lastUpdateEntity != null && temp == null)) { lastUpdateEntity = temp; flag = true; } else if (lastUpdateEntity != null && temp != null && (temp.getMaxId() != lastUpdateEntity.getMaxId() || temp.getLastDate().getTime() != lastUpdateEntity.getLastDate().getTime() || temp.getCount() != lastUpdateEntity.getCount())) { lastUpdateEntity = temp; flag = true; } transaction.setStatus(Transaction.SUCCESS); } catch (Exception e) { transaction.setStatus(e); } finally { transaction.complete(); } if (!flag && cacheDataMap.get().size() == 0) { log.warn("dbNode数据为空，请注意！"); return true; } return flag; }  @Override void start(); @Override void updateCache(); @Override void checkDataSource(DbNodeEntity dbNodeEntity); @Override boolean hasSlave(DbNodeEntity dbNodeEntity); @Override void createDataSource(DbNodeEntity t1); void initDataSource(DbNodeEntity t1, String key, Map<String, DataSource> dataMap, boolean isMaster,
							   Transaction transaction); @Override Map<Long, DbNodeEntity> getCache(); @Override Map<String, List<DbNodeEntity>> getCacheByIp(); @Override void forceUpdateCache(); @PreDestroy @Override void stop(); @Override DataSource getDataSource(long id, boolean isMaster); @Override String info(); @Override Map<String, DataSource> getDataSource(); @Override void startPortal(); @Override void stopPortal(); @Override String getCacheJson();  }### Answer:
@Test public void checkChangedTest() { assertEquals(true, dbNodeServiceImpl.checkChanged()); LastUpdateEntity lastUpdateEntity = new LastUpdateEntity(); lastUpdateEntity.setCount(1); lastUpdateEntity.setMaxId(2L); when(dbNodeRepository.getLastUpdate()).thenReturn(lastUpdateEntity); assertEquals(true, dbNodeServiceImpl.checkChanged()); lastUpdateEntity = new LastUpdateEntity(); lastUpdateEntity.setCount(11); lastUpdateEntity.setMaxId(2L); dbNodeServiceImpl.lastUpdateEntity = lastUpdateEntity; assertEquals(true, dbNodeServiceImpl.checkChanged()); doThrow(new RuntimeException("test")).when(dbNodeRepository).getLastUpdate(); assertEquals(true, dbNodeServiceImpl.checkChanged()); }