@Test
public void testParseSimpleFeatureType() throws Exception {

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

        Name typeName = Types.typeName(NS_URI, "simpleFeatureType");
        AttributeType type = parsedTypes.getAttributeType(typeName);
        Assert.assertNotNull(type);
        Assert.assertTrue(type.getClass().getName(), type instanceof ComplexType);
        Assert.assertTrue(type.getUserData().get(XSDTypeDefinition.class) instanceof XSDComplexTypeDefinition);

        ComplexType ft = (ComplexType) type;
        String local = ft.getName().getLocalPart();
        String uri = ft.getName().getNamespaceURI();
        Assert.assertEquals("simpleFeatureType", local);
        Assert.assertEquals(NS_URI, uri);

        List<PropertyDescriptor> attributes = Arrays.asList(((ComplexFeatureTypeImpl) ft)
                .getTypeDescriptors().toArray(new PropertyDescriptor[0]));
        Assert.assertEquals(8, attributes.size());
        AttributeDescriptor descriptor;

        descriptor = (AttributeDescriptor) attributes.get(5);
        Name name = Types.typeName(NS_URI, "the_geom");
        typeName = Types.typeName(GML.NAMESPACE, "GeometryPropertyType");
        
        // I do not think this is true anymore, as abstract geometry type
        // is an AttributeTypeImpl
        // assertTrue(descriptor.getType() instanceof GeometryType);

        assertSimpleAttribute(descriptor, name, typeName, Geometry.class, 1, 1);

        descriptor = (AttributeDescriptor) attributes.get(6);
        name = Types.typeName(NS_URI, "stringAtt");
        typeName = Types.typeName(XS.NAMESPACE, XS.STRING.getLocalPart());

        assertSimpleAttribute(descriptor, name, typeName, String.class, 1, 1);

        descriptor = (AttributeDescriptor) attributes.get(7);
        name = Types.typeName(NS_URI, "intAtt");
        typeName = Types.typeName(XS.NAMESPACE, XS.INT.getLocalPart());
        assertSimpleAttribute(descriptor, name, typeName, Integer.class, 1, 1);
    }
    finally {
        parsedTypes.disposeSchemaIndexes();
    }
}