@Test
public void testBadXml() {

    try {
        URL configFile = this.getClass().getClassLoader().getResource(
                "org/apache/tiles/config/malformed-defs.xml");
        assertNotNull("Config file not found", configFile);

        InputStream source = configFile.openStream();
        reader.read(source);
        fail("Should've thrown an exception.");
    } catch (DefinitionsFactoryException e) {
        // correct.
        if (log.isDebugEnabled()) {
            log.debug("Exception caught, it is OK", e);
        }
    } catch (Exception e) {
        fail("Exception reading configuration." + e);
    }
}