@Test void writePropertiesFile_noMerging() throws IOException { final HashMap<String, String> expectedProperties = new HashMap<>( ImmutableMap.<String, String>builder() .put("key1", "value1") .put("key2", "value2") .build() ); final Properties properties = new Properties(); properties.putAll(ImmutableMap.of("key1", "value1", "key2", "value2")); WriterHelper.writePropertiesFile(testProjectDir, documentFileUtils, properties, TEST_PROPERTIES); assertPropertiesContents(expectedProperties); }
private static <B extends GatewayEntity> void writePropertiesFile(File rootFolder, DocumentFileUtils documentFileUtils, Map<String, B> beans, String fileName) { File configFolder = new File(rootFolder, CONFIG_DIRECTORY); documentFileUtils.createFolder(configFolder.toPath()); Properties properties = new Properties(); properties.putAll(beans .values() .stream() .map(b -> { b.preWrite(configFolder, documentFileUtils); return (PropertiesEntity) b; }) .collect(toMap(PropertiesEntity::getKey, PropertiesEntity::getValue))); writePropertiesFile(rootFolder, documentFileUtils, properties, fileName); }
WriterHelper { private static <B extends GatewayEntity> void writePropertiesFile(File rootFolder, DocumentFileUtils documentFileUtils, Map<String, B> beans, String fileName) { File configFolder = new File(rootFolder, CONFIG_DIRECTORY); documentFileUtils.createFolder(configFolder.toPath()); Properties properties = new Properties(); properties.putAll(beans .values() .stream() .map(b -> { b.preWrite(configFolder, documentFileUtils); return (PropertiesEntity) b; }) .collect(toMap(PropertiesEntity::getKey, PropertiesEntity::getValue))); writePropertiesFile(rootFolder, documentFileUtils, properties, fileName); } }
WriterHelper { private static <B extends GatewayEntity> void writePropertiesFile(File rootFolder, DocumentFileUtils documentFileUtils, Map<String, B> beans, String fileName) { File configFolder = new File(rootFolder, CONFIG_DIRECTORY); documentFileUtils.createFolder(configFolder.toPath()); Properties properties = new Properties(); properties.putAll(beans .values() .stream() .map(b -> { b.preWrite(configFolder, documentFileUtils); return (PropertiesEntity) b; }) .collect(toMap(PropertiesEntity::getKey, PropertiesEntity::getValue))); writePropertiesFile(rootFolder, documentFileUtils, properties, fileName); } private  WriterHelper(); }
WriterHelper { private static <B extends GatewayEntity> void writePropertiesFile(File rootFolder, DocumentFileUtils documentFileUtils, Map<String, B> beans, String fileName) { File configFolder = new File(rootFolder, CONFIG_DIRECTORY); documentFileUtils.createFolder(configFolder.toPath()); Properties properties = new Properties(); properties.putAll(beans .values() .stream() .map(b -> { b.preWrite(configFolder, documentFileUtils); return (PropertiesEntity) b; }) .collect(toMap(PropertiesEntity::getKey, PropertiesEntity::getValue))); writePropertiesFile(rootFolder, documentFileUtils, properties, fileName); } private  WriterHelper();  }
WriterHelper { private static <B extends GatewayEntity> void writePropertiesFile(File rootFolder, DocumentFileUtils documentFileUtils, Map<String, B> beans, String fileName) { File configFolder = new File(rootFolder, CONFIG_DIRECTORY); documentFileUtils.createFolder(configFolder.toPath()); Properties properties = new Properties(); properties.putAll(beans .values() .stream() .map(b -> { b.preWrite(configFolder, documentFileUtils); return (PropertiesEntity) b; }) .collect(toMap(PropertiesEntity::getKey, PropertiesEntity::getValue))); writePropertiesFile(rootFolder, documentFileUtils, properties, fileName); } private  WriterHelper();   }