ExecutablePlainForm implements Dialog { public Collection<AbstractCatchElement> getCatchElements() { if (form == null) { return null; } final Collection<AbstractCatchElement> catches = new java.util.ArrayList<AbstractCatchElement>(); final NodeList children = form.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; } ExecutablePlainForm(); @Override void setNode(final XmlNode node); String getId(); Collection<XmlNode> getChildNodes(); 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 Form form = vxml.appendChild(Form.class); form.appendChild(Filled.class); final Noinput noinput = form.appendChild(Noinput.class); final Help help = form.appendChild(Help.class); final Catch catchNode = form.appendChild(Catch.class); catchNode.setEvent("test"); final ExecutablePlainForm dialog = new ExecutablePlainForm(); dialog.setNode(form); 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 + "'"); } } }