@Test public void testPropertiesFileWriter() throws RendererException, IOException { Map<String, String> map = new HashMap<>(); map.put("key1", "val1"); map.put("key2", "val2"); PropertiesFileWriter propertiesFileWriter = new PropertiesFileWriter(); Path path = Paths.get(MY_TEST_PROPERTIES_FILE_WRITER_FILE); propertiesFileWriter.write(path, map); try (InputStream input = new FileInputStream(path.toString())) { Properties prop = new Properties(); prop.load(input); Assert.assertEquals(2, prop.size()); Assert.assertTrue(prop.containsKey("key1")); Assert.assertTrue(prop.containsKey("key2")); } assertTrue(new File(System.getProperty("user.dir"), MY_TEST_PROPERTIES_FILE_WRITER_FILE).exists()); }
public static void write(Object result, FileOptions options) throws RendererException { Objects.requireNonNull(result); Object content = Objects.requireNonNull(getFileStrategy(options, result)).render(); FileWriter fileWriter = getFileWriter(options.getType()); fileWriter.write(new File(options.getName()).toPath(), content); }
FileWriterEngine { public static void write(Object result, FileOptions options) throws RendererException { Objects.requireNonNull(result); Object content = Objects.requireNonNull(getFileStrategy(options, result)).render(); FileWriter fileWriter = getFileWriter(options.getType()); fileWriter.write(new File(options.getName()).toPath(), content); } }
FileWriterEngine { public static void write(Object result, FileOptions options) throws RendererException { Objects.requireNonNull(result); Object content = Objects.requireNonNull(getFileStrategy(options, result)).render(); FileWriter fileWriter = getFileWriter(options.getType()); fileWriter.write(new File(options.getName()).toPath(), content); } private  FileWriterEngine(); }
FileWriterEngine { public static void write(Object result, FileOptions options) throws RendererException { Objects.requireNonNull(result); Object content = Objects.requireNonNull(getFileStrategy(options, result)).render(); FileWriter fileWriter = getFileWriter(options.getType()); fileWriter.write(new File(options.getName()).toPath(), content); } private  FileWriterEngine(); static void write(Object result, FileOptions options); }
FileWriterEngine { public static void write(Object result, FileOptions options) throws RendererException { Objects.requireNonNull(result); Object content = Objects.requireNonNull(getFileStrategy(options, result)).render(); FileWriter fileWriter = getFileWriter(options.getType()); fileWriter.write(new File(options.getName()).toPath(), content); } private  FileWriterEngine(); static void write(Object result, FileOptions options);  }