public void ClassFieldMappingTest1(){
try {
clearMappings();
CtPackage ctPackage = launcher.getFactory().Package().getOrCreate("com.example");
CtClass ctClass = launcher.getFactory().Class().create("com.example.TestClass1");
ctPackage.getTypes().add(ctClass);
HashSet<ModifierKind> modifiers = new HashSet<ModifierKind>();
modifiers.add(ModifierKind.PUBLIC);
CtTypeReference ctTypeRef = launcher.getFactory().Type().createReference(String.class.getName());
@SuppressWarnings("unused")
CtField ctField = launcher.getFactory().Field().create(ctClass, modifiers, ctTypeRef, "myField");
scanner.visitCtPackage(ctPackage);
XSDComplexTypeDefinition complexType = scanner.typeXSDComplexTypeMap.get(ctClass);
XSDParticle parentParticle = (XSDParticle)complexType.getContent();
XSDModelGroup parentModelGroup = (XSDModelGroup)parentParticle.getContent();
XSDParticle localElementParticle = (XSDParticle)parentModelGroup.getContents().get(0);
XSDElementDeclaration elementdecl = (XSDElementDeclaration)localElementParticle.getContent();
assertTrue(elementdecl.getName().equals("myField"));
assertTrue(elementdecl.getTargetNamespace().equals(ctPackage.getQualifiedName()));
}catch(Exception e){
System.err.println("Exception: " + e.getMessage());
assertTrue(false);
}
}