@Test void loadEntityWithoutConstructor() { PropertiesLoaderTest loader = new PropertiesLoaderTest(FileUtils.INSTANCE, new IdGenerator()); assertThrows(ConfigLoadException.class, () -> loader.load(new Bundle(), "key", "value")); }
@Override public Map<String, Object> load(final File propertiesFile) { Map<String, Object> propertiesMap = new LinkedHashMap<>(); if (propertiesFile != null && propertiesFile.exists()) { Properties properties = new Properties(); try (InputStream inStream = fileUtils.getInputStream(propertiesFile)) { properties.load(inStream); } catch (IOException e) { throw new ConfigLoadException("Could not load properties file (" + propertiesFile + "): " + e.getMessage(), e); } properties.forEach((k, v) -> propertiesMap.put(k.toString(), v.toString())); } return propertiesMap; }
PropertiesLoaderBase implements EntityLoader { @Override public Map<String, Object> load(final File propertiesFile) { Map<String, Object> propertiesMap = new LinkedHashMap<>(); if (propertiesFile != null && propertiesFile.exists()) { Properties properties = new Properties(); try (InputStream inStream = fileUtils.getInputStream(propertiesFile)) { properties.load(inStream); } catch (IOException e) { throw new ConfigLoadException("Could not load properties file (" + propertiesFile + "): " + e.getMessage(), e); } properties.forEach((k, v) -> propertiesMap.put(k.toString(), v.toString())); } return propertiesMap; } }
PropertiesLoaderBase implements EntityLoader { @Override public Map<String, Object> load(final File propertiesFile) { Map<String, Object> propertiesMap = new LinkedHashMap<>(); if (propertiesFile != null && propertiesFile.exists()) { Properties properties = new Properties(); try (InputStream inStream = fileUtils.getInputStream(propertiesFile)) { properties.load(inStream); } catch (IOException e) { throw new ConfigLoadException("Could not load properties file (" + propertiesFile + "): " + e.getMessage(), e); } properties.forEach((k, v) -> propertiesMap.put(k.toString(), v.toString())); } return propertiesMap; } PropertiesLoaderBase(final FileUtils fileUtils, final IdGenerator idGenerator); }
PropertiesLoaderBase implements EntityLoader { @Override public Map<String, Object> load(final File propertiesFile) { Map<String, Object> propertiesMap = new LinkedHashMap<>(); if (propertiesFile != null && propertiesFile.exists()) { Properties properties = new Properties(); try (InputStream inStream = fileUtils.getInputStream(propertiesFile)) { properties.load(inStream); } catch (IOException e) { throw new ConfigLoadException("Could not load properties file (" + propertiesFile + "): " + e.getMessage(), e); } properties.forEach((k, v) -> propertiesMap.put(k.toString(), v.toString())); } return propertiesMap; } PropertiesLoaderBase(final FileUtils fileUtils, final IdGenerator idGenerator); @Override Map<String, Object> load(final File propertiesFile); @Override Object loadSingle(String name, File entitiesFile); @Override void load(Bundle bundle, File rootDir); @Override void load(Bundle bundle, String name, String value); }
PropertiesLoaderBase implements EntityLoader { @Override public Map<String, Object> load(final File propertiesFile) { Map<String, Object> propertiesMap = new LinkedHashMap<>(); if (propertiesFile != null && propertiesFile.exists()) { Properties properties = new Properties(); try (InputStream inStream = fileUtils.getInputStream(propertiesFile)) { properties.load(inStream); } catch (IOException e) { throw new ConfigLoadException("Could not load properties file (" + propertiesFile + "): " + e.getMessage(), e); } properties.forEach((k, v) -> propertiesMap.put(k.toString(), v.toString())); } return propertiesMap; } PropertiesLoaderBase(final FileUtils fileUtils, final IdGenerator idGenerator); @Override Map<String, Object> load(final File propertiesFile); @Override Object loadSingle(String name, File entitiesFile); @Override void load(Bundle bundle, File rootDir); @Override void load(Bundle bundle, String name, String value);  }