void () { Entry dir = new DirectoryEntry(null); Entry child1 = new FileEntry("child1", null, -1, false); Entry child2 = new DirectoryEntry("child2"); Entry child3 = new FileEntry("child3", null, -1, false); dir.addChild(child1); dir.addChild(child2); child2.addChild(child3); Entry copy = dir.copy(); List<Entry> children = copy.getChildren(); assertEquals(2, children.size()); assertEquals(1, children.get(1).getChildren().size()); Entry copyChild1 = children.get(0); Entry copyChild2 = children.get(1); Entry copyChild3 = copyChild2.getChildren().get(0); assertSame(copy, copyChild1.getParent()); assertSame(copy, copyChild2.getParent()); assertSame(copyChild2, copyChild3.getParent()); }