VoiceXmlInterpreter { public Dialog getDialog(final String id) { if (id == null) { LOGGER.warn("unable to get form with a null id"); return null; } if (dialogs == null) { LOGGER.warn("dialogs not initialized. can not determine dialog" + " with id '" + id + "'"); return null; } for (Dialog dialog : dialogs) { final String currentId = dialog.getId(); if (id.equalsIgnoreCase(currentId)) { return dialog; } } return null; } VoiceXmlInterpreter(final VoiceXmlInterpreterContext ctx); FormInterpretationAlgorithm getFormInterpretationAlgorithm(); InterpreterState getState(); void setState(final InterpreterState newState); Dialog getNextDialog(); Dialog getDialog(final String id); void process(final Dialog dialog,
            final Map<String, Object> parameters); void enterFinalProcessingState(); boolean isInFinalProcessingState(); Locale getLanguage();  }
@Test public void testGetDialog() throws Exception { final VoiceXmlDocument document = new VoiceXmlDocument(); final Vxml vxml = document.getVxml(); final Form form1 = vxml.appendChild(Form.class); final String id1 = "horst"; form1.setId(id1); final Form form2 = vxml.appendChild(Form.class); final String id2 = "hans"; form2.setId(id2); interpreter.setDocument(document, null, configuration); final Dialog dialog1 = interpreter.getDialog(id1); Assert.assertEquals(id1, dialog1.getId()); final Dialog dialog2 = interpreter.getDialog(id2); Assert.assertEquals(id2, dialog2.getId()); final Dialog dialog3 = interpreter.getDialog("unknown"); Assert.assertNull("execpted to find no form", dialog3); final Dialog dialog4 = interpreter.getDialog(null); Assert.assertNull("execpted to find no form", dialog4); }
@Test public void testGetDialogNoDocument() throws Exception { final Dialog dialog = interpreter.getDialog("unknown"); Assert.assertNull("execpted to find no form", dialog); }