AdditionalPropertiesParser { public Properties parse() { Properties properties = new Properties(); if (propertiesString != null) { String lastKey = null; final String[] splittedProperties = split(propertiesString, LIST_SEPARATOR); for (String singleKeyValue : splittedProperties) { final String[] splittedKeyValue = split(singleKeyValue, KEY_VALUE_SEPARATOR); switch (splittedKeyValue.length) { case 2: { final String key = correctSingleQuotes(splittedKeyValue[0].trim()); lastKey = key; final String value = correctSingleQuotes(splittedKeyValue[1].trim()); final String existingValue = properties.getProperty(key); if (existingValue != null) { properties.setProperty(key, existingValue + LIST_SEPARATOR + value); } else { properties.setProperty(key, value); } break; } case 1: { if (lastKey != null) { final String value = correctSingleQuotes(splittedKeyValue[0].trim()); final String existingValue = properties.getProperty(lastKey); if (existingValue != null) { properties.setProperty(lastKey, existingValue + LIST_SEPARATOR + value); } else { properties.setProperty(lastKey, value); } } break; } default: LOG.warning("Found illegal properties " + Arrays.toString(splittedKeyValue)); } } } return properties; } AdditionalPropertiesParser(String propertiesString); static Properties merge(Properties base, Properties addtional); Properties parse();  }
@Test(dataProvider = "ParsingResultProvider") public void testParse(String propertiesString, Properties resultingProperties) throws Exception { assertEquals(resultingProperties, new AdditionalPropertiesParser(propertiesString).parse(), "Wrong properties from parsing found."); }