ConfigNode { public Optional<ConfigNode> getNode(String path) { if (path == null) { return Optional.empty(); } String[] parts = splitPathInTwo(path); String key = parts[0]; String leftover = parts[1]; if (leftover.isEmpty()) { return Optional.ofNullable(childNodes.get(key)); } else { return getNode(key).flatMap(child -> child.getNode(leftover)); } } ConfigNode(String key, ConfigNode parent, String value); Optional<ConfigNode> getNode(String path); boolean contains(String path); ConfigNode addNode(String path); boolean removeNode(String path); void remove(); boolean moveChild(String oldPath, String newPath); String getKey(boolean deep); void sort(); void reorder(List<String> newOrder); void save(); void set(String path, T value); void set(T value); List<String> getComment(); void setComment(List<String> comment); List<String> getStringList(); Integer getInteger(); Long getLong(); String getString(); boolean getBoolean(); List<String> getStringList(String path); Map<String, String> getStringMap(boolean fullKeys); Integer getInteger(String path); Long getLong(String path); String getString(String path); boolean getBoolean(String path); void copyMissing(ConfigNode from); void copyAll(ConfigNode from); ConfigNode getParent(); boolean isLeafNode(); Collection<ConfigNode> getChildren(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test void firstLevelNodeIsFound() { assertTrue(testTree.getNode(SIMPLE_STRING_NODE).isPresent(), "Node was not found"); }
@Test void secondLevelNodeIsFound() { assertTrue(testTree.getNode(FIRST_LEVEL + "." + SECOND_LEVEL).isPresent(), "Node was not found"); }
@Test void getNodeDoesNotAddNodes() { assertFalse(testTree.getNode("NonexistentNode").isPresent()); }