}
}
@Test
public void testIncludesAndImports() throws Exception {
Resource hr = new ClassPathResource("hr.xsd", getClass());
collection.setXsds(new Resource[]{hr});
collection.setInline(true);
collection.afterPropertiesSet();
XsdSchema[] schemas = collection.getXsdSchemas();
Assert.assertEquals("Invalid amount of XSDs loaded", 2, schemas.length);
Assert.assertEquals("Invalid target namespace", "http://mycompany.com/hr/schemas", schemas[0].getTargetNamespace());
Resource hr_employee = new ClassPathResource("hr_employee.xsd", getClass());
Document expected = documentBuilder.parse(SaxUtils.createInputSource(hr_employee));
DOMResult domResult = new DOMResult();
transformer.transform(schemas[0].getSource(), domResult);
assertXMLEqual("Invalid XSD generated", expected, (Document) domResult.getNode());
Assert.assertEquals("Invalid target namespace", "http://mycompany.com/hr/schemas/holiday", schemas[1].getTargetNamespace());
Resource holiday = new ClassPathResource("holiday.xsd", getClass());
expected = documentBuilder.parse(SaxUtils.createInputSource(holiday));
domResult = new DOMResult();
transformer.transform(schemas[1].getSource(), domResult);
assertXMLEqual("Invalid XSD generated", expected, (Document) domResult.getNode());