EventStrategyDecoratorFactory { public EventStrategy getDecorator( final VoiceXmlInterpreterContext context, final VoiceXmlInterpreter interpreter, final FormInterpretationAlgorithm fia, final CatchContainer item) { if (item == null) { LOGGER.warn("can not obtain a decorator for a null input item"); return null; } final String tagName = item.getNodeTagName(); final EventStrategyPrototype prototype = STRATEGIES.get(tagName); if (prototype == null) { LOGGER.warn("no decorator for tag '" + tagName + "'"); return null; } return prototype.newInstance(context, interpreter, fia, item); }  EventStrategy getDecorator(
            final VoiceXmlInterpreterContext context,
            final VoiceXmlInterpreter interpreter,
            final FormInterpretationAlgorithm fia, final CatchContainer item);  }
@Test public void testGetDecorator() throws Exception { final VoiceXmlDocument document = new VoiceXmlDocument(); final Vxml vxml = document.getVxml(); final Form form = vxml.appendChild(Form.class); final Field field = form.appendChild(Field.class); final ObjectTag object = form.appendChild(ObjectTag.class); final Record record = form.appendChild(Record.class); final Initial initial = form.appendChild(Initial.class); final FieldFormItem fieldItem = new FieldFormItem(context, field); final EventStrategyDecoratorFactory factory = new EventStrategyDecoratorFactory(); final EventStrategy strategy1 = factory.getDecorator(context, null, null, fieldItem); Assert.assertNotNull(strategy1); Assert.assertEquals(InputItemRecognitionEventStrategy.class, strategy1.getClass()); final RecordFormItem recordItem = new RecordFormItem(context, record); final EventStrategy strategy2 = factory.getDecorator(context, null, null, recordItem); Assert.assertNotNull(strategy2); Assert.assertEquals(RecordingEventStrategy.class, strategy2.getClass()); final ObjectFormItem objectItem = new ObjectFormItem(context, object); final EventStrategy strategy3 = factory.getDecorator(context, null, null, objectItem); Assert.assertNotNull(strategy3); Assert.assertEquals(ObjectTagEventStrategy.class, strategy3.getClass()); final InitialFormItem initialItem = new InitialFormItem(context, initial); final EventStrategy strategy4 = factory.getDecorator(context, null, null, initialItem); Assert.assertNotNull(strategy4); Assert.assertEquals(FormLevelRecognitionEventStrategy.class, strategy4.getClass()); final EventStrategy strategy5 = factory.getDecorator(context, null, null, null); Assert.assertNull("expected a null strategy for a null input item", strategy5); }