KeyTree { public KeyTree.Node findParent(final int indent) { return this.findParent(this.root, indent); } KeyTree(final YamlConfigurationOptions options); KeyTree.Node add(final String path); KeyTree.Node findParent(final int indent); KeyTree.Node get(final String path); Set<String> keys(); Set<Map.Entry<String, KeyTree.Node>> entries(); @Override String toString();  }
@Test void findParent() { final YamlConfiguration configuration = new YamlConfiguration(); final YamlConfigurationOptions options = new TestYamlConfigurationOptions(configuration); final KeyTree tree = new KeyTree(options); final String nodekey = "nodekey"; tree.add(nodekey); final KeyTree.Node node = tree.get(nodekey); node.add("test-child"); node.add("test-child-2"); final KeyTree.Node parent = tree.findParent(2); MatcherAssert.assertThat( "The node has a root!", parent.getIndentation(), new IsEqual<>(0) ); MatcherAssert.assertThat( "The node's name is not correct!", parent.getName(), new IsEqual<>(nodekey) ); MatcherAssert.assertThat( "There is a a comment!", parent.getComment(), new IsNull<>() ); MatcherAssert.assertThat( "There is a side comment!", parent.getSideComment(), new IsNull<>() ); }