@Test(expected = CluecumberPluginException.class) public void loadInvalidPropertiesMapTest() throws CluecumberPluginException { propertiesFileLoader.loadPropertiesMap("nonexistent"); }
LinkedHashMap<String, String> loadPropertiesMap(final String propertiesFilePath) throws CluecumberPluginException { LinkedHashMap<String, String> propertiesMap; String content = fileIO.readContentFromFile(propertiesFilePath); LinkedProperties properties = new LinkedProperties(); try { properties.load(new StringReader(content)); } catch (IOException e) { throw new CluecumberPluginException("Could not parse properties file '" + "': " + e.getMessage()); } propertiesMap = properties.entrySet().stream().collect(Collectors.toMap(propertyEntry -> (String) propertyEntry.getKey(), propertyEntry -> (String) propertyEntry.getValue(), (a, b) -> b, LinkedHashMap::new)); return propertiesMap; }
PropertiesFileLoader { LinkedHashMap<String, String> loadPropertiesMap(final String propertiesFilePath) throws CluecumberPluginException { LinkedHashMap<String, String> propertiesMap; String content = fileIO.readContentFromFile(propertiesFilePath); LinkedProperties properties = new LinkedProperties(); try { properties.load(new StringReader(content)); } catch (IOException e) { throw new CluecumberPluginException("Could not parse properties file '" + "': " + e.getMessage()); } propertiesMap = properties.entrySet().stream().collect(Collectors.toMap(propertyEntry -> (String) propertyEntry.getKey(), propertyEntry -> (String) propertyEntry.getValue(), (a, b) -> b, LinkedHashMap::new)); return propertiesMap; } }
PropertiesFileLoader { LinkedHashMap<String, String> loadPropertiesMap(final String propertiesFilePath) throws CluecumberPluginException { LinkedHashMap<String, String> propertiesMap; String content = fileIO.readContentFromFile(propertiesFilePath); LinkedProperties properties = new LinkedProperties(); try { properties.load(new StringReader(content)); } catch (IOException e) { throw new CluecumberPluginException("Could not parse properties file '" + "': " + e.getMessage()); } propertiesMap = properties.entrySet().stream().collect(Collectors.toMap(propertyEntry -> (String) propertyEntry.getKey(), propertyEntry -> (String) propertyEntry.getValue(), (a, b) -> b, LinkedHashMap::new)); return propertiesMap; } @Inject  PropertiesFileLoader(final FileIO fileIO); }
PropertiesFileLoader { LinkedHashMap<String, String> loadPropertiesMap(final String propertiesFilePath) throws CluecumberPluginException { LinkedHashMap<String, String> propertiesMap; String content = fileIO.readContentFromFile(propertiesFilePath); LinkedProperties properties = new LinkedProperties(); try { properties.load(new StringReader(content)); } catch (IOException e) { throw new CluecumberPluginException("Could not parse properties file '" + "': " + e.getMessage()); } propertiesMap = properties.entrySet().stream().collect(Collectors.toMap(propertyEntry -> (String) propertyEntry.getKey(), propertyEntry -> (String) propertyEntry.getValue(), (a, b) -> b, LinkedHashMap::new)); return propertiesMap; } @Inject  PropertiesFileLoader(final FileIO fileIO);  }
PropertiesFileLoader { LinkedHashMap<String, String> loadPropertiesMap(final String propertiesFilePath) throws CluecumberPluginException { LinkedHashMap<String, String> propertiesMap; String content = fileIO.readContentFromFile(propertiesFilePath); LinkedProperties properties = new LinkedProperties(); try { properties.load(new StringReader(content)); } catch (IOException e) { throw new CluecumberPluginException("Could not parse properties file '" + "': " + e.getMessage()); } propertiesMap = properties.entrySet().stream().collect(Collectors.toMap(propertyEntry -> (String) propertyEntry.getKey(), propertyEntry -> (String) propertyEntry.getValue(), (a, b) -> b, LinkedHashMap::new)); return propertiesMap; } @Inject  PropertiesFileLoader(final FileIO fileIO);   }