FormInterpretationAlgorithm implements FormItemVisitor { public void visitFieldFormItem(final InputItem field) throws JVoiceXMLEvent { if (LOGGER.isDebugEnabled()) { LOGGER.debug("visiting field '" + field.getName() + "'..."); } final EventHandler handler = context.getEventHandler(); eventStrategies = handler.collect(context, interpreter, this, field); final ImplementationPlatform platform = context .getImplementationPlatform(); final EventBus eventbus = context.getEventBus(); platform.setEventBus(eventbus); platform.waitNonBargeInPlayed(); final UserInput input = platform.getUserInput(); final CallControl call = platform.getCallControl(); try { if (call != null) { final CallControlProperties callProps = context .getCallControlProperties(this); call.record(input, callProps); } final DataModel model = context.getDataModel(); final SpeechRecognizerProperties speech = context .getSpeechRecognizerProperties(this); final DtmfRecognizerProperties dtmf = context .getDtmfRecognizerProperties(this); final ActiveGrammarSet activeGrammars = context.getActiveGrammarSet(); final Collection<ModeType> types = activeGrammars.getModeTypes(); input.startRecognition(model, types, speech, dtmf); } catch (ConfigurationException e) { throw new NoresourceError(e.getMessage(), e); } catch (IOException e) { throw new BadFetchError("error recording", e); } } FormInterpretationAlgorithm(final VoiceXmlInterpreterContext ctx,
            final VoiceXmlInterpreter ip, final Dialog currentDialog); Dialog getDialog(); VoiceXmlInterpreterContext getVoiceXmlInterpreterContext(); TagStrategyExecutor getTagStrategyExecutor(); void initialize(final Profile prof,
            final Map<String, Object> parameters); FormItem getFormItem(final String name); Collection<FormItem> getFormItems(); FormItem getFormItem(); void mainLoop(); void setJustFilled(final InputItem input); boolean isJustFilled(final InputItem input); boolean isQueuingPrompts(); GrammarDocument processGrammar(final Grammar grammar); void visitBlockFormItem(final BlockFormItem block); void visitFieldFormItem(final InputItem field); void visitInitialFormItem(final InitialFormItem initial); void visitObjectFormItem(final ObjectFormItem object); void visitRecordFormItem(final RecordFormItem record); void visitSubdialogFormItem(final SubdialogFormItem subdialog); void visitTransferFormItem(final TransferFormItem transfer); void setReprompt(final boolean on); String getLocalProperty(final String name); void setLocalProperty(final String name, final String value);  }
@Test public void testVisitFieldFormItem() throws Exception, JVoiceXMLEvent { final VoiceXmlDocument doc = new VoiceXmlDocument(); final Vxml vxml = doc.getVxml(); final Form form = vxml.appendChild(Form.class); final Field field = form.appendChild(Field.class); final Dialog executableForm = new ExecutablePlainForm(); executableForm.setNode(form); final FormInterpretationAlgorithm fia = new FormInterpretationAlgorithm( context, interpreter, executableForm); final InputItem item = new FieldFormItem(context, field); fia.visitFieldFormItem(item); final MockUserInput input = (MockUserInput) platform.getUserInput(); Assert.assertNotNull(input); Assert.assertTrue(input.isRecognitionStarted()); }