### Question:
XmlaRepositoryImpl implements Repository, UpdatableXMLAContainer { @Override public List<String> getDatabaseNames(RolapConnection connection) { return new ArrayList<String>(getServerInfo().datasourceMap.keySet()); }  void setXmlaContentFinder(XmlaContentFinder xmlaContentFinder); void setLocator(CatalogLocator locator); void setCacheTimeout(long cacheTimeout); void setCatalogDelimiter(String catalogDelimiter); @Override List<String> getDatabaseNames(RolapConnection connection); @Override List<String> getCatalogNames(RolapConnection connection, String databaseName); @Override Map<String, RolapSchema> getRolapSchemas(RolapConnection connection, String databaseName, String catalogName); @Override List<Map<String, Object>> getDatabases(RolapConnection connection); @Override void clearCache(); @Override void shutdown(); @Override void updateXMLAConnection(MondrianXMLADefinition oldDef, MondrianXMLADefinition newDef); @Override OlapConnection getConnection(MondrianServer server, String databaseName, String catalogName, String roleName,
            Properties props);  }### Answer:
@Test public void getDatabaseNames_ServerContainsOneDataSource_ReturnOneDatabaseName() { doReturn(getDataSourcesByTenantId(TEST_ORGANIZATION_1)).when(xmlaContentFinder).getDataSources(); List<String> databaseNames = xmlaRepository.getDatabaseNames(any(RolapConnection.class)); assertEquals(1, databaseNames.size()); }
@Test public void getDatabaseNames_ServerDoesNotContainsAnyDataSource_ReturnEmptyList() { doReturn(null).when(xmlaContentFinder).getDataSources(); List<String> databaseNames = xmlaRepository.getDatabaseNames(any(RolapConnection.class)); assertEquals(0, databaseNames.size()); }