@Test
public void testAddDocument() throws JVoiceXMLEvent, Exception {

    final Application application = new JVoiceXmlApplication(observer);
    VoiceXmlDocument doc1 = new VoiceXmlDocument();
    final Vxml vxml1 = doc1.getVxml();
    final URI testUri1 = createUri("scheme", "host", "/path", "fragment");
    vxml1.setXmlBase(testUri1);
    Assert.assertFalse(application.isLoaded(testUri1));
    application.addDocument(testUri1, doc1);
    Assert.assertTrue(application.isLoaded(testUri1));
    Assert.assertEquals(testUri1, application.getXmlBase());
    VoiceXmlDocument doc2 = new VoiceXmlDocument();
    final Vxml vxml2 = doc2.getVxml();
    final URI testUri2 = createUri("scheme", "host", "/path", "fragment");
    vxml2.setXmlBase(testUri2);
    application.addDocument(testUri2, doc2);
    Assert.assertTrue(application.isLoaded(testUri2));
    Assert.assertEquals(testUri1, application.getXmlBase());
    VoiceXmlDocument doc3 = new VoiceXmlDocument();
    final Vxml vxml3 = doc3.getVxml();
    final URI testUri3 =
        createUri("scheme3", "host3", "/path3", "fragment3");
    vxml3.setXmlBase(testUri3);
    application.addDocument(testUri3, doc3);
    Assert.assertEquals(testUri3, application.getXmlBase());
    final URI testUri31 =
        createUri("scheme3", "host3", "/path3", null);
    Assert.assertTrue("fragment less document is also loaded",
            application.isLoaded(testUri31));
}