@Test
public void testSimpleAttributeFromComplexDeclaration() throws Exception {

    String res = "/test-data/complexFeature.xsd";
    URL resource = getClass().getResource(res);
    SchemaIndex schemaIndex = EmfAppSchemaReader.newInstance().parse(resource);
    AppSchemaFeatureTypeRegistry registry = new AppSchemaFeatureTypeRegistry();
    try {
        registry.addSchemas(schemaIndex);

        Name tcl = Types.typeName(NS_URI, "TypedCategoryListType");
        AttributeType typedCategoryListType = registry.getAttributeType(tcl);
        Assert.assertNotNull(typedCategoryListType);
        Assert.assertTrue(typedCategoryListType instanceof ComplexType);

        AttributeType superType = typedCategoryListType.getSuper();
        Assert.assertNotNull(superType);
        Name superName = superType.getName();
        Assert.assertEquals(XS.STRING.getNamespaceURI(), superName.getNamespaceURI());
        Assert.assertEquals(XS.STRING.getLocalPart(), superName.getLocalPart());

        Assert.assertNotNull(typedCategoryListType.getUserData().get(XSDTypeDefinition.class));
    }
    finally {
        registry.disposeSchemaIndexes();
    }
}