PropertiesMappingParser { public Map<String, List<String>> parse(final InputStream mapping) { final Properties mappingProperties = new Properties(); try { mappingProperties.load(mapping); final Map<String, List<String>> serializedContent = new HashMap<>(); final Set<String> kinds = mappingProperties.stringPropertyNames(); for (String kind : kinds) { final String filenames = mappingProperties.getProperty(kind); final String[] filenameTypes = filenames.split(","); final List<String> scannedFiletypes = new ArrayList<>(); for (final String filenameType : filenameTypes) { scannedFiletypes.add(filenameType.trim()); } serializedContent.put(kind, scannedFiletypes); } return serializedContent; } catch (IOException e) { throw new IllegalStateException(e); } }  Map<String, List<String>> parse(final InputStream mapping);  }
@Test public void should_read_mappings_from_properties_file() { final PropertiesMappingParser propertiesMappingParser = new PropertiesMappingParser(); final Map<String, List<String>> serializedContent = propertiesMappingParser.parse(new ByteArrayInputStream(MAPPING_PROPERTIES.getBytes())); final Map<String, List<String>> expectedSerlializedContent = new HashMap<>(); expectedSerlializedContent.put("ConfigMap", Arrays.asList("cm", "configmap")); assertThat(serializedContent) .containsAllEntriesOf(expectedSerlializedContent); }