DefaultHandlers.MODEL_GROUP_HANDLER = XB_DEFAULT_MODELGROUP_HANDLER;
}
protected <T> T unmarshalObjectFromSchema(Class<T> expected) throws Exception
{
MultiClassSchemaResolver resolver = new MultiClassSchemaResolver();
// TODO this is a mess
String nsURI = "http://www.jboss.org/test/xml/" + rootName;
String packageName = getClass().getPackage().getName();
packageName = packageName.replace(".", "/");
String name = getClass().getName();
int dot = name.lastIndexOf('.');
if (dot != -1)
name = name.substring(dot + 1);
dot = name.lastIndexOf("UnitTestCase");
if (dot != -1)
name = name.substring(0, dot);
String testXsd = packageName + '/' + name + ".xsd";
resolver.mapSchemaLocation(nsURI, testXsd);
resolver.mapSchemaInitializer(nsURI, JBossXBBuilder.newInitializer(expected));
String testXml = findTestXml();
Object o = unmarshal(testXml, expected, resolver);
assertNotNull(o);
getLog().debug("Unmarshalled " + o + " of type " + o.getClass().getName());