ExecutableMenuForm implements Dialog { public Collection<AbstractCatchElement> getCatchElements() { if (menu == null) { return null; } final Collection<AbstractCatchElement> catches = new java.util.ArrayList<AbstractCatchElement>(); final NodeList children = menu.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { final Node child = children.item(i); if (child instanceof AbstractCatchElement) { final AbstractCatchElement catchElement = (AbstractCatchElement) child; catches.add(catchElement); } } return catches; } ExecutableMenuForm(); @Override void setNode(final XmlNode node); void setChoiceConverter(final ChoiceConverter choiceConverter); @Override String getId(); @Override Collection<XmlNode> getChildNodes(); @Override Collection<FormItem> getFormItems(
            final VoiceXmlInterpreterContext context); Collection<Filled> getFilledElements(); Collection<AbstractCatchElement> getCatchElements(); @Override Dialog clone();  }
@Test public void testGetCatchElements() throws Exception { final VoiceXmlDocument document = new VoiceXmlDocument(); final Vxml vxml = document.getVxml(); final Menu menu = vxml.appendChild(Menu.class); final Noinput noinput = menu.appendChild(Noinput.class); final Help help = menu.appendChild(Help.class); final Catch catchNode = menu.appendChild(Catch.class); catchNode.setEvent("test"); final ExecutableMenuForm dialog = new ExecutableMenuForm(); dialog.setNode(menu); dialog.setChoiceConverter(new SrgsXmlChoiceConverter()); final Collection<AbstractCatchElement> elements = dialog.getCatchElements(); Assert.assertEquals(3, elements.size()); for (AbstractCatchElement element : elements) { String tag = element.getTagName(); if (tag.equals(Noinput.TAG_NAME)) { Assert.assertTrue("expected to find noinput element", element.isEqualNode(noinput)); } else if (tag.equals(Help.TAG_NAME)) { Assert.assertTrue("expected to find help element", element.isEqualNode(help)); } else if (tag.equals(Catch.TAG_NAME)) { Assert.assertTrue("expected to find catch element", element.isEqualNode(catchNode)); } else { Assert.fail("unknown tag: '" + tag + "'"); } } }