Menu { public void delete() { Collection children = getChildren(); Iterator childrenIt = children.iterator(); while (childrenIt.hasNext()) { ChildIF currentChild = (ChildIF)childrenIt.next(); currentChild.delete(); } topic.remove(); } Menu(TopicIF topic); String getTitle(); TopicIF getTopic(); TopicIF getOwner(); List getChildren(); boolean getHasChildren(); void setTitle(String title); void setOwner(TopicIF owner); Heading createHeading(String title); Item createItem(String title); void delete();  }
@Test public void testDeleteMenu() throws IOException { TopicMapIF tm = load("condition-menu.ltm"); TopicIF topic = getTopicById(tm, "menu1"); Assert.assertTrue("menu topic not found", topic != null); Menu menu = new Menu(topic); TopicIF tname = tm.getTopicBySubjectIdentifier(PSI.getSAMNameType()); Assert.assertNotNull(tname); Assert.assertEquals(24, tm.getTopics().size()); Assert.assertEquals(6, tm.getAssociations().size()); menu.delete(); Assert.assertEquals(21, tm.getTopics().size()); Assert.assertEquals(1, tm.getAssociations().size()); Assert.assertNull(topic.getTopicMap()); }