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