AssignStrategy extends AbstractTagStrategy { public void execute(final VoiceXmlInterpreterContext context, final VoiceXmlInterpreter interpreter, final FormInterpretationAlgorithm fia, final FormItem item, final VoiceXmlNode node) throws JVoiceXMLEvent { final DataModel model = context.getDataModel(); model.updateVariable(name, expr); if (LOGGER.isDebugEnabled()) { final String log = model.toString(expr); LOGGER.debug("assigned var '" + name + "' to value: '" + log + "'"); } } AssignStrategy(); Collection<String> getEvalAttributes(); @Override void validateAttributes(final DataModel model); void execute(final VoiceXmlInterpreterContext context,
            final VoiceXmlInterpreter interpreter,
            final FormInterpretationAlgorithm fia, final FormItem item,
            final VoiceXmlNode node);  }
@Test public void testExecute() throws Exception, SemanticError { final AssignStrategy strategy = new AssignStrategy(); AssignStrategy clonedStrategy1 = (AssignStrategy) strategy .newInstance(); final String var = "test"; final Block block = createBlock(); final Assign assign = block.appendChild(Assign.class); assign.setName(var); assign.setExpr("'assigned'"); final DataModel model = getDataModel(); Mockito.when(model.evaluateExpression("'assigned'", Object.class)) .thenReturn("'assigned'"); Mockito.when(model.toString("'assigned'")).thenReturn("'assigned'"); try { executeTagStrategy(assign, clonedStrategy1); } catch (JVoiceXMLEvent e) { Assert.fail(e.getMessage()); } Mockito.verify(model).evaluateExpression("'assigned'", Object.class); Mockito.verify(model).updateVariable(var, "'assigned'"); }