JavaPropertiesHelper { public Properties getProperties(String propertiesString) { Properties properties = new Properties(); StringReader reader = new StringReader(propertiesString); try { properties.load(reader); } catch (IOException e) { throw new IllegalArgumentException("Error loading properties from string reader. See cause for details.", e); } return properties; }  Map<String, Object> toMap(Properties properties); Properties getProperties(String propertiesString); Properties getProperties(InputStream inputStream);  }
@Test public void testGetPropertiesFromInputStream() { ByteArrayInputStream inputStream = new ByteArrayInputStream("foo=bar".getBytes()); Properties properties = javaPropertiesHelper.getProperties(inputStream); Assert.assertEquals("properties value 'foo'", "bar", properties.get("foo")); }
@Test public void testGetPropertiesFromString() { Properties properties = javaPropertiesHelper.getProperties("foo=bar"); Assert.assertEquals("properties value 'foo'", "bar", properties.get("foo")); }