GroupZipper { public GroupZipper up() { if (!canUp()) { throw new NoSuchElementException("Could not move up because this group does not have a parent"); } this.index = parent.index; this.node = parent.node; this.parent = parent.parent; 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 shouldThrowExeptionWhileMovingUpWithoutParent() { KeePassFile keePassFile = createFlatGroupStructure(); GroupZipper zipper = new GroupZipper(keePassFile); expectedException.expect(RuntimeException.class); expectedException.expectMessage("Could not move up because this group does not have a parent"); zipper.up(); }