GroupZipper { public GroupZipper down() { if (!canDown()) { throw new NoSuchElementException("Could not move down because this group does not have any children"); } parent = new GroupZipper(parent, node, index); index = 0; node = node.getGroups().get(0); return this; } 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 shouldThrowExeptionWhileMovingDownWithoutChilds() { KeePassFile keePassFile = createFlatGroupStructure(); GroupZipper zipper = new GroupZipper(keePassFile).down(); expectedException.expect(RuntimeException.class); expectedException.expectMessage("Could not move down because this group does not have any children"); zipper.down(); }