ImportDeclarationPersistenceBackendService implements ConfigPersistenceBackendService<ImportDeclaration> { @Override public List<ConfigItem<ImportDeclaration>> load(Map<String, String> metadata) throws PersistenceException, InvalidConfigurationException { List<ConfigItem<ImportDeclaration>> ret; LOGGER.debug("loading ImportDeclaration Configuration"); if (storageFile.exists()) { if (metadata.get(ImportDeclaration.META_IMPORT_CLASS) == null) { ret = loadAllImports(); } else { ret = loadSingleImport(metadata.get(ImportDeclaration.META_IMPORT_CLASS)); } } else { LOGGER.debug( "Can't load configuration, because \"{}\" doesn't exist. Returning default empty list!", storageFile); ret = new ArrayList<ConfigItem<ImportDeclaration>>(); } return ret; }  @Override List<ConfigItem<ImportDeclaration>> load(Map<String, String> metadata); @SuppressWarnings("unchecked") @Override void persist(ConfigItem<ImportDeclaration> config); @Override void remove(Map<String, String> metadata); @Override boolean supports(Class<? extends ConfigItem<?>> configItemType); void setStorageFilePath(String storageFilePath);  }
@Test public void testLoadImportConfigurationWithEmptyFile_shouldReturnEmptyList() throws Exception { FileUtils.forceDelete(storageFile); List<ConfigItem<ImportDeclaration>> loaded = service.load(new HashMap<String, String>()); assertEquals(0, loaded.size()); }