GroupZipper { public KeePassFile cloneKeePassFile() { Iterator<Group> iter = iterator(); while(iter.hasNext()) { Group group = iter.next(); Group clonedGroup = cloneGroup(group); replace(clonedGroup); } return close(); } GroupZipper(KeePassFile keePassFile); private  GroupZipper(GroupZipper parent, Group group, int index); boolean canDown(); GroupZipper down(); boolean canUp(); GroupZipper up(); boolean canRight(); GroupZipper right(); boolean canLeft(); GroupZipper left(); Group getNode(); GroupZipper replace(Group group); KeePassFile close(); KeePassFile cloneKeePassFile(); Group getRoot(); GroupZipper replaceMeta(Meta meta); @Override String toString(); Iterator<Group> iterator();  }
@Test public void shouldCreateCloneFromTreeStructure() { KeePassFile keePassFile = createTreeStructure(); KeePassFile clonedKeePassFile = new GroupZipper(keePassFile).cloneKeePassFile(); compareKeePassFiles(keePassFile, clonedKeePassFile); }
@Test public void shouldCreateCloneFromFlatStructure() { KeePassFile keePassFile = createFlatGroupStructure(); KeePassFile clonedKeePassFile = new GroupZipper(keePassFile).cloneKeePassFile(); compareKeePassFiles(keePassFile, clonedKeePassFile); }