@Test
public void testWithTwoSelfDependentCycles()
                        throws Exception {

    GMLAppSchemaReader xsdDecoder = new GMLAppSchemaReader( null, null, schemaWithTwoSelfDependentCycles );
    AppSchema appSchema = xsdDecoder.extractAppSchema();
    CRSRef storageCrs = CRSManager.getCRSRef( "EPSG:4326" );
    GeometryStorageParams geometryParams = new GeometryStorageParams( storageCrs, String.valueOf( "0" ), DIM_2 );
    AppSchemaMapper mapper = new AppSchemaMapper( appSchema, false, true, geometryParams, 63, true, true, 1 );
    MappedAppSchema mappedSchema = mapper.getMappedSchema();
    Map<QName, FeatureTypeMapping> ftMappings = mappedSchema.getFtMappings();
    assertThat( ftMappings.size(), is( 1 ) );
    FeatureTypeMapping featureA = mappedSchema.getFtMapping( FEATURE_A );
    List<Mapping> mappings = featureA.getMappings();
    assertThat( mappings.size(), is( 5 ) );
    // Depth 0 - Cycle 0
    CompoundMapping featureCDepth0 = getFeatureC( mappings );
    List<Mapping> featureCDepth0Mapping = featureCDepth0.getParticles();
    assertThat( featureCDepth0Mapping.size(), is( 4 ) );
    // Depth 1
    CompoundMapping featureDDepth1 = getFeatureD( featureCDepth0Mapping );
    List<Mapping> featureDDepth1Mapping = featureDDepth1.getParticles();
    assertThat( featureDDepth1Mapping.size(), is( 3 ) );
    CompoundMapping featureEDepth1 = getFeatureE( featureCDepth0Mapping );
    List<Mapping> featureEDepth1Mapping = featureEDepth1.getParticles();
    assertThat( featureEDepth1Mapping.size(), is( 3 ) );
    // Depth 2 - Cycle 1
    CompoundMapping featureCDepth2 = getFeatureC( featureDDepth1Mapping );
    List<Mapping> featureCDepth2Mapping = featureCDepth2.getParticles();
    assertThat( featureCDepth2Mapping.size(), is( 4 ) );
    CompoundMapping featureEDepth2 = getFeatureC( featureEDepth1Mapping );
    List<Mapping> featureEDepth2Mapping = featureEDepth2.getParticles();
    assertThat( featureEDepth2Mapping.size(), is( 4 ) );
    // Depth 3
    CompoundMapping featureDofCDepth2Depth3 = getFeatureD( featureCDepth2Mapping );
    List<Mapping> featureDofCDepth2Depth3Mapping = featureDofCDepth2Depth3.getParticles();
    assertThat( featureDofCDepth2Depth3Mapping.size(), is( 2 ) );
    CompoundMapping featureEofCDepth2Depth3 = getFeatureE( featureCDepth2Mapping );
    List<Mapping> featureEofCDepth2Depth3Mapping = featureEofCDepth2Depth3.getParticles();
    assertThat( featureEofCDepth2Depth3Mapping.size(), is( 2 ) );
    CompoundMapping featureDofEDepth2Depth3 = getFeatureD( featureEDepth2Mapping );
    List<Mapping> featureDofEDepth2Depth3Mapping = featureDofEDepth2Depth3.getParticles();
    assertThat( featureDofEDepth2Depth3Mapping.size(), is( 2 ) );
    CompoundMapping featureEofEDepth2Depth3 = getFeatureE( featureEDepth2Mapping );
    List<Mapping> featureEofEDepth2Depth3Mapping = featureEofEDepth2Depth3.getParticles();
    assertThat( featureEofEDepth2Depth3Mapping.size(), is( 2 ) );
    // Depth 4 - End
    assertThat( getFeatureC( featureDofCDepth2Depth3Mapping ), is( nullValue() ) );
    assertThat( getFeatureC( featureEofCDepth2Depth3Mapping ), is( nullValue() ) );
    assertThat( getFeatureC( featureDofEDepth2Depth3Mapping ), is( nullValue() ) );
    assertThat( getFeatureC( featureEofEDepth2Depth3Mapping ), is( nullValue() ) );
}