@Test public void testSimpleLoading(@TempDirectory.TempDir Path tempDir) throws IOException { URL url = getClass().getResource("/example.conf"); final Path saveTest = tempDir.resolve("text1.txt"); HoconConfigurationLoader loader = HoconConfigurationLoader.builder() .setSource(() -> new BufferedReader(new InputStreamReader(url.openStream(), UTF_8))) .setSink(AtomicFiles.createAtomicWriterFactory(saveTest, UTF_8)).build(); CommentedConfigurationNode node = loader.load(); assertEquals("unicorn", node.getNode("test", "op-level").getValue()); assertEquals("dragon", node.getNode("other", "op-level").getValue()); CommentedConfigurationNode testNode = node.getNode("test"); assertEquals(" Test node", testNode.getComment().orElse(null)); assertEquals("dog park", node.getNode("other", "location").getValue()); loader.save(node); assertEquals(Resources.readLines(getClass().getResource("/roundtrip-test.conf"), UTF_8), Files .readAllLines(saveTest, UTF_8)); }