Search in sources :

Example 1 with TestScopeProvider

use of nl.nn.adapterframework.testutil.TestScopeProvider in project iaf by ibissource.

the class XmlUtilsTest method testIdentityTransformWithDefaultEntityResolver.

@Test
public void testIdentityTransformWithDefaultEntityResolver() throws Exception {
    // External EntityResolving is still possible with the XMLEntityResolver
    Resource resource = Resource.getResource(new TestScopeProvider(), "XmlUtils/EntityResolution/in-file-entity-c-temp.xml");
    SAXException thrown = assertThrows(SAXException.class, () -> {
        XmlUtils.parseXml(resource, new XmlWriter());
    });
    String errorMessage = "Cannot get resource for publicId [null] with systemId [file:///c:/temp/test.xml] in scope [URLResource ";
    assertTrue("SaxParseException should start with [Cannot get resource ...] but is [" + thrown.getMessage() + "]", thrown.getMessage().startsWith(errorMessage));
}
Also used : TestScopeProvider(nl.nn.adapterframework.testutil.TestScopeProvider) Resource(nl.nn.adapterframework.core.Resource) XmlWriter(nl.nn.adapterframework.xml.XmlWriter) SAXException(org.xml.sax.SAXException) Test(org.junit.Test)

Aggregations

Resource (nl.nn.adapterframework.core.Resource)1 TestScopeProvider (nl.nn.adapterframework.testutil.TestScopeProvider)1 XmlWriter (nl.nn.adapterframework.xml.XmlWriter)1 Test (org.junit.Test)1 SAXException (org.xml.sax.SAXException)1