CommentDumper extends CommentReader { @Override protected KeyTree.Node getNode(final String path) { return this.commentMapper.getNode(path); } CommentDumper(final YamlConfigurationOptions options, final CommentMapper commentMapper, final Reader reader); String dump();  }
@Test void getNode() { final StringReader reader = new StringReader("test: 'test'\n" + "test-2: 'test-2'"); final YamlConfiguration configuration = new YamlConfiguration(); final YamlConfigurationOptions options = new TestYamlConfigurationOptions(configuration); final CommentMapper mapper = new CommentMapper(options); mapper.setComment("test", "test comment"); mapper.setComment("test", "test comment", CommentType.SIDE); mapper.setComment("test-2", "test comment"); mapper.setComment("test-2", "test comment", CommentType.SIDE); final CommentDumper dumper = new CommentDumper(options, mapper, reader); final KeyTree.Node testnode = dumper.getNode("test"); final KeyTree.Node test2node = dumper.getNode("test-2"); MatcherAssert.assertThat( "The indention is not 0!", testnode.getIndentation(), new IsEqual<>(0) ); MatcherAssert.assertThat( "The node name is not correct!", testnode.getName(), new IsEqual<>("test") ); MatcherAssert.assertThat( "The comment's node is wrong", testnode.getComment(), new IsEqual<>("# test comment\n") ); MatcherAssert.assertThat( "The side comment's node is wrong", testnode.getSideComment(), new IsEqual<>(" # test comment") ); MatcherAssert.assertThat( "The indention is not 0!", test2node.getIndentation(), new IsEqual<>(0) ); MatcherAssert.assertThat( "The node name is not correct!", test2node.getName(), new IsEqual<>("test-2") ); MatcherAssert.assertThat( "The Comment's node is wrong", test2node.getComment(), new IsEqual<>("# test comment\n") ); MatcherAssert.assertThat( "The side comment's node is wrong", test2node.getSideComment(), new IsEqual<>(" # test comment") ); }