/** * Test method for {@link * ValueStrategy#execute(org.jvoicexml.interpreter.VoiceXmlInterpreterContext, * org.jvoicexml.interpreter.VoiceXmlInterpreter, * org.jvoicexml.interpreter.FormInterpretationAlgorithm, org.jvoicexml.interpreter.FormItem, * org.jvoicexml.xml.VoiceXmlNode)} . * * @exception Exception Test failed. * @exception JVoiceXMLEvent test failed */ @Test(expected = SemanticError.class) public void testExecuteUndefined() throws Exception, JVoiceXMLEvent { final String name = "test"; final Block block = createBlock(); final Value value = block.appendChild(Value.class); value.setExpr(name); final ValueStrategy strategy = new ValueStrategy(); executeTagStrategy(value, strategy); }
/** * Test method for {@link * VarStrategy#execute(org.jvoicexml.interpreter.VoiceXmlInterpreterContext, * org.jvoicexml.interpreter.VoiceXmlInterpreter, * org.jvoicexml.interpreter.FormInterpretationAlgorithm, org.jvoicexml.interpreter.FormItem, * org.jvoicexml.xml.VoiceXmlNode)} . * * @exception Exception Test failed. * @exception JVoiceXMLEvent test failed */ @Test public void testExecuteExpr() throws Exception, JVoiceXMLEvent { final String name = "test"; final String val = "this is a test"; final Block block = createBlock(); final Value value = block.appendChild(Value.class); value.setExpr(name); final DataModel model = getDataModel(); Mockito.when(model.evaluateExpression(name, Object.class)).thenReturn(val); final ValueStrategy strategy = new ValueStrategy(); executeTagStrategy(value, strategy); final SsmlDocument ssml = new SsmlDocument(); final Speak speak = ssml.getSpeak(); speak.addText("this is a test"); final SpeakableText speakable = new SpeakableSsmlText(ssml); final ImplementationPlatform platform = getContext().getImplementationPlatform(); Mockito.verify(platform).queuePrompt(speakable); }