RegistryKey extends AbstractRegistryNode { @Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("+ ").append(this.name).append("\n"); for (AbstractRegistryNode child : children) { for (String line : child.toString().split("\n")) { stringBuilder.append("| ").append(line).append("\n"); } } return stringBuilder.toString(); } RegistryKey(String name); @Override String toString(); @Override String toRegString(); AbstractRegistryNode addChild(AbstractRegistryNode newChild); AbstractRegistryNode addDeepChildren(AbstractRegistryNode... newChildren); RegistryKey addDeepChildren(String... newChildren); List<AbstractRegistryNode> getChildren(); AbstractRegistryNode getChild(int i); AbstractRegistryNode getChild(String childName); AbstractRegistryNode getChild(List<String> childrenNames); AbstractRegistryNode getChild(String... childrenNames); void addChildren(AbstractRegistryNode... nodes);  }
@Test public void testRegistryKeyToStringGoodFormat() { assertEquals("+ A1\n" + "| + B1\n" + "| + B2\n" + "| | + C1\n" + "| | | - (StringValueType) V1 -> Content 1\n" + "| | + C2\n" + "| | | - (StringValueType) V2 -> Content 2\n" + "| | | - (StringValueType) V3 -> Content 3\n", a1.toString()); }