CommentReader extends CommentMapper { protected KeyTree.Node track() { int indent = 0; String key = null; if (this.currentLine != null) { final MatchResult groups = this.match(this.currentLine); indent = groups.group(1).length(); if (groups.groupCount() > 1) { key = groups.group(2); } } final KeyTree.Node parent = this.keyTree.findParent(indent); return parent.add(indent, key); } protected  CommentReader(final YamlConfigurationOptions options, final Reader reader);   }
@Test void track() throws IOException { final StringReader reader = new StringReader(CommentReaderTest.COMMENT); final YamlConfiguration configuration = new YamlConfiguration(); final YamlConfigurationOptions options = new TestYamlConfigurationOptions(configuration); final CommentReader commentReader = new CommentReader(options, reader); commentReader.nextLine(); final KeyTree.Node track = commentReader.track(); MatcherAssert.assertThat( "The node has a root!", track.getIndentation(), new IsEqual<>(0) ); MatcherAssert.assertThat( "The node's name is not correct!", track.getName(), new IsNull<>() ); MatcherAssert.assertThat( "There is a comment!", track.getComment(), new IsNull<>() ); MatcherAssert.assertThat( "There is a side comment!", track.getSideComment(), new IsNull<>() ); }