### Question:
DbNodeServiceImpl extends AbstractBaseService<DbNodeEntity> implements CacheUpdateService, DbNodeService, TimerService, PortalTimerService { @Override public void createDataSource(DbNodeEntity t1) { createDataSource(t1, cacheDataMap.get()); }  @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 createDataSourceTest() 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(); dbNodeEntity.setIp("fasaf"); dbNodeEntity.setDbUserName("faf"); dbNodeEntity.setDbPass("aff"); dbNodeEntity.setPort(2342); dbNodeEntity.setIpBak("faf"); dbNodeEntity.setDbUserNameBak("fa"); dbNodeEntity.setDbPassBak("faf"); dbNodeEntity.setPortBak(3); dbNodeServiceImpl.createDataSource(dbNodeEntity); dbNodeServiceImpl.createDataSource(dbNodeEntity); assertEquals(true, dbNodeServiceImpl.cacheDataMap.get().size() == 2); doThrow(new SQLException()).when(dataSource).init(); dbNodeServiceImpl.dbCreated.clear(); dbNodeServiceImpl.cacheDataMap.set(new HashMap<String, DataSource>()); dbNodeServiceImpl.createDataSource(dbNodeEntity); assertEquals(true, dbNodeServiceImpl.cacheDataMap.get().size() == 0); }