/** * Set up the test environment. * * @exception Exception set up failed */ @Before public void setUp() throws Exception { final MockJvoiceXmlCore jvxml = new MockJvoiceXmlCore(); final ImplementationPlatform platform = new MockImplementationPlatform(); final Profile profile = Mockito.mock(Profile.class); final SsmlParsingStrategyFactory factory = Mockito.mock(SsmlParsingStrategyFactory.class); Mockito.when(profile.getSsmlParsingStrategyFactory()).thenReturn(factory); final JVoiceXmlSession session = new JVoiceXmlSession(platform, jvxml, null, profile); final Configuration configuration = Mockito.mock(Configuration.class); context = new VoiceXmlInterpreterContext(session, configuration); }
/** * Set up the test environment. * * @since 0.7.6 */ @Before public void setUp() { final SsmlParsingStrategyFactory factory = Mockito.mock(SsmlParsingStrategyFactory.class); Mockito.when(factory.getParsingStrategy(Mockito.isA(Value.class))) .thenReturn(new ValueStrategy()); final VoiceXmlInterpreterContext context = getContext(); final Profile profile = context.getProfile(); Mockito.when(profile.getSsmlParsingStrategyFactory()).thenReturn(factory); Mockito.when(profile.getSsmlParsingStrategyFactory()).thenReturn(factory); final TagStrategyFactory tagfactory = Mockito.mock(TagStrategyFactory.class); Mockito.when(tagfactory.getTagStrategy(Mockito.isA(Value.class))) .thenReturn(new ValueStrategy()); Mockito.when(tagfactory.getTagStrategy(Mockito.isA(Text.class))).thenReturn(new TextStrategy()); Mockito.when(profile.getTagStrategyFactory()).thenReturn(tagfactory); final ImplementationPlatform platform = Mockito.mock(ImplementationPlatform.class); Mockito.when(context.getImplementationPlatform()).thenReturn(platform); }