### Question:
DataSourceRepositoryManager implements DataSourceInformationRepositoryListener { public DataSource getDataSource(String name) { if (name == null || "".equals(name)) { throw new SynapseCommonsException("DataSource name cannot be found.", log); } DataSource result = inMemoryDataSourceRepository.lookUp(name); if (result != null) { if (log.isDebugEnabled()) { log.debug("DataSource is found in the in-memory data source repository." + " Datasource name is : " + name); } return result; } if (jndiBasedDataSourceRepository.isInitialized()) { result = jndiBasedDataSourceRepository.lookUp(name); if (result != null) { if (log.isDebugEnabled()) { log.debug("DataSource is found in the JNDI data source repository." + " Datasource name is : " + name); } return result; } } if (log.isDebugEnabled()) { log.debug("Cannot find a datasource with name : " + name + " either in in-memory or" + " JNDI datasource repositories"); } return result; } DataSourceRepositoryManager(InMemoryDataSourceRepository inMemoryDataSourceRepository,
                                       JNDIBasedDataSourceRepository jndiBasedDataSourceRepository); DataSource getDataSource(String name); void addDataSourceInformation(DataSourceInformation dataSourceInformation); void removeDataSourceInformation(DataSourceInformation dataSourceInformation); void reConfigure(Properties confProperties); void clear();  }### Answer:
@Test public void testGetDataSourceEmpty() { thrown.expectMessage("DataSource name cannot be found."); thrown.expect(SynapseCommonsException.class); repositoryManager.getDataSource(""); }
@Test public void testGetDataSourceNonExisting() { Assert.assertNull("not existing datasource should return null", repositoryManager.getDataSource(ERROR_DATASOURCE_NAME)); }