GroupZipper { public Iterator<Group> iterator() { return new GroupIterator(); } 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 shouldIterateThroughAllGroups() { KeePassFile keePassFile = createTreeStructure(); GroupZipper zipper = new GroupZipper(keePassFile); Iterator<Group> iter = zipper.iterator(); List<Group> visitedGroups = new ArrayList<Group>(); while (iter.hasNext()) { Group group = iter.next(); visitedGroups.add(group); } Assert.assertEquals(6, visitedGroups.size()); }