@Test
public void testRead() throws IOException {

    URL configFile = this.getClass().getClassLoader().getResource(
            "org/apache/tiles/config/tiles-defs.xml");
    assertNotNull("Config file not found", configFile);
    InputStream source = configFile.openStream();
    Map<String, Definition> definitions = reader.read(source);
    assertNotNull("Definitions not returned.", definitions);
    assertNotNull("Couldn't find doc.mainLayout tile.",
            definitions.get("doc.mainLayout"));
    assertNotNull("Couldn't Find title attribute.", definitions.get(
            "doc.mainLayout").getAttribute("title").getValue());
    assertEquals("Incorrect Find title attribute.",
            "Tiles Library Documentation", definitions.get(
                    "doc.mainLayout").getAttribute("title").getValue());
    Definition def = definitions.get("doc.role.test");
    assertNotNull("Couldn't find doc.role.test tile.", def);
    Attribute attribute = def.getAttribute("title");
    assertNotNull("Couldn't Find title attribute.", attribute
            .getValue());
    assertEquals("Role 'myrole' expected", attribute.getRole(),
            "myrole");
    def = definitions.get("doc.listattribute.test");
    assertNotNull("Couldn't find doc.listattribute.test tile.", def);
    attribute = def.getAttribute("items");
    assertNotNull("Couldn't Find items attribute.", attribute);
    assertTrue("The class of the attribute is not right",
            attribute instanceof ListAttribute);
    assertTrue("The class of value of the attribute is not right",
            attribute.getValue() instanceof List);
}