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);   }
@Test(expected = CluecumberPluginException.class) public void loadInvalidPropertiesMapTest() throws CluecumberPluginException { propertiesFileLoader.loadPropertiesMap("nonexistent"); }
@Test public void loadPropertiesMapTest() throws CluecumberPluginException { final LinkedHashMap<String, String> propertiesMap = propertiesFileLoader.loadPropertiesMap("src/test/resources/test.properties"); assertThat(propertiesMap.size(), is(2)); }