### Question:
DbNodeServiceImpl extends AbstractBaseService<DbNodeEntity> implements CacheUpdateService, DbNodeService, TimerService, PortalTimerService { @Override public void checkDataSource(DbNodeEntity dbNodeEntity) { try { checkMaster(dbNodeEntity); checkSlave(dbNodeEntity); } catch (Exception e) { throw new RuntimeException(e); } }  @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 checkDataSourceTest() throws SQLException { DruidDataSource dataSource = mock(DruidDataSource.class); DbNodeServiceImpl.DataSourceFactory dataSourceFactory = new DbNodeServiceImpl.DataSourceFactory() { @Override public DruidDataSource createDataSource() { return dataSource; } }; dbNodeServiceImpl.setDataSourceFactory(dataSourceFactory); DbNodeEntity dbNodeEntity = new DbNodeEntity(); boolean flag = false; try { dbNodeServiceImpl.checkDataSource(dbNodeEntity); } catch (Exception e) { flag = true; } assertEquals(false, flag); doThrow(new SQLException("tet")).when(dataSource).init(); flag = false; try { dbNodeServiceImpl.checkDataSource(dbNodeEntity); } catch (Exception e) { flag = true; } assertEquals(true, flag); }