### Question:
FileSystemManager implements Initializable { public List<String> getTopLevelDirectories(Set<String> exclude) { if (exclude == null) { exclude = new HashSet<>(); } List<String> directories = new ArrayList<>(); File mainDir = new File(getBaseDirectory()); File files[] = mainDir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { String path = file.getPath(); if (!exclude.contains(path)) { directories.add(file.getPath()); } } } } directories.sort(null); return directories; } protected  FileSystemManager(); static FileSystemManager getInstance(); List<String> getTopLevelDirectories(Set<String> exclude); File getDir(String directory); File getConfig(String configFilename); File getImportLookup(String configFilename); File getImportLookup(String configFilename, NewFileHandler newFileHandler); InputStream getApplicationResourceFile(String resource); long copy(InputStream source, OutputStream sink); @Override void initialize(); @Override void shutdown(); @Override boolean isStarted(); String getBaseDirectory(); void setBaseDirectory(String baseDirectory); static final String MAIN_PERM_DIR; static final String MAIN_TEMP_DIR; static final String SYSTEM_TEMP_DIR; static final String CONFIG_DIR; static final String IMPORT_DIR; static final String IMPORT_HISTORY_DIR; static final String IMPORT_LOOKUP_DIR; static final String IMPORT_ARTICLE_DIR; static final String IMPORT_HIGHLIGHT_DIR; static final String IMPORT_COMPONENT_DIR; static final String ARTICLE_DIR; static final String MEDIA_DIR; static final String ATTACHMENT_DIR; static final String ARCHIVE_DIR; static final String GENERAL_MEDIA_DIR; static final String SUPPORT_MEDIA_DIR; static final String TEMPORARY_MEDIA_DIR; static final String ERROR_TICKET_DIR; static final String RESOURCE_DIR; static final String ORGANIZATION_DIR; static final String REPORT_DIR; static final String PLUGIN_DIR; static final String COMPONENT_VERSION_DIR; static final String PLUGIN_UNINSTALLED_DIR; static final String PLUGIN_FAILED_DIR; static final String DB_DIR; }### Answer:
@Test public void testGetTopLevelDirectories() { LOG.info("getTopLevelDirectories"); Set<String> exclude = null; LOG.info("Scenario 1: Default no exclude"); List<String> expResult = Arrays.asList( testFileSystemManager.getBaseDirectory() + FileSystemManager.IMPORT_DIR.replace("/", File.separator), testFileSystemManager.getBaseDirectory() + FileSystemManager.MAIN_PERM_DIR.replace("/", File.separator), testFileSystemManager.getBaseDirectory() + FileSystemManager.MAIN_TEMP_DIR.replace("/", File.separator) ); testFileSystemManager.initialize(); List<String> result = testFileSystemManager.getTopLevelDirectories(exclude); assertEquals(expResult, result); exclude = new HashSet<>(); exclude.add(testFileSystemManager.getBaseDirectory() + FileSystemManager.IMPORT_DIR.replace("/", File.separator)); LOG.info("Scenario 2: Test Exclude"); expResult = Arrays.asList( testFileSystemManager.getBaseDirectory() + FileSystemManager.MAIN_PERM_DIR.replace("/", File.separator), testFileSystemManager.getBaseDirectory() + FileSystemManager.MAIN_TEMP_DIR.replace("/", File.separator) ); result = testFileSystemManager.getTopLevelDirectories(exclude); assertEquals(expResult, result); }