@Test void yamlSourceCreatesDirectories() throws IOException { YamlSource source = new YamlSource(configPath, YamlProperties.DEFAULT); Path parentDir = configPath.getParent(); assertThat(Files.exists(parentDir), is(false)); source.saveConfiguration(new TestClass(configPath), mapOf()); assertThat(Files.exists(parentDir), is(true)); }
@Override public void saveConfiguration(YamlConfiguration config, Map<String, Object> map) throws IOException { createParentDirectories(); CommentAdder adder = new CommentAdder( yaml.dump(map), config.getComments(), props ); String commentedDump = adder.getCommentedDump(); Files.write(configPath, commentedDump.getBytes()); }
YamlSource implements ConfigurationSource<YamlConfiguration> { @Override public void saveConfiguration(YamlConfiguration config, Map<String, Object> map) throws IOException { createParentDirectories(); CommentAdder adder = new CommentAdder( yaml.dump(map), config.getComments(), props ); String commentedDump = adder.getCommentedDump(); Files.write(configPath, commentedDump.getBytes()); } }
YamlSource implements ConfigurationSource<YamlConfiguration> { @Override public void saveConfiguration(YamlConfiguration config, Map<String, Object> map) throws IOException { createParentDirectories(); CommentAdder adder = new CommentAdder( yaml.dump(map), config.getComments(), props ); String commentedDump = adder.getCommentedDump(); Files.write(configPath, commentedDump.getBytes()); } YamlSource(Path configPath, YamlProperties props); }
YamlSource implements ConfigurationSource<YamlConfiguration> { @Override public void saveConfiguration(YamlConfiguration config, Map<String, Object> map) throws IOException { createParentDirectories(); CommentAdder adder = new CommentAdder( yaml.dump(map), config.getComments(), props ); String commentedDump = adder.getCommentedDump(); Files.write(configPath, commentedDump.getBytes()); } YamlSource(Path configPath, YamlProperties props); @Override void saveConfiguration(YamlConfiguration config, Map<String, Object> map); @Override Map<String, Object> loadConfiguration(YamlConfiguration config); }
YamlSource implements ConfigurationSource<YamlConfiguration> { @Override public void saveConfiguration(YamlConfiguration config, Map<String, Object> map) throws IOException { createParentDirectories(); CommentAdder adder = new CommentAdder( yaml.dump(map), config.getComments(), props ); String commentedDump = adder.getCommentedDump(); Files.write(configPath, commentedDump.getBytes()); } YamlSource(Path configPath, YamlProperties props); @Override void saveConfiguration(YamlConfiguration config, Map<String, Object> map); @Override Map<String, Object> loadConfiguration(YamlConfiguration config);  }