}
@Test
public void testAnonymousClassInitializer() {
FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$1", null));
FamixMethod oinitTest = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.<oinit>()", null));
FamixMethod oinitAnonym = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$1.<oinit>()", null));
FamixMethod initAnonym = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$1.<init>()", null));
FamixAttribute anonymAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.ae.Test$1.anonymAttribute", null));
assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$1", anonymClass);
assertNotNull("FamixModel must contain initializer testPackage.ae.Test.<oinit>()", oinitTest);
assertNotNull("FamixModel must contain anonymous class initializer testPackage.ae.Test$1.<oinit>()", oinitAnonym);
assertNotNull("FamixModel must contain anonymous class initializer testPackage.ae.Test$1.<init>()", initAnonym);
assertNotNull("FamixModel must contain ananymous class attribute testPackage.ae.Test$1.anonymAttribute", anonymAttribute);
assertNotNull(oinitAnonym);
assertTrue("Anonymous class must contain initializer " + oinitAnonym.getUniqueName(), anonymClass.getMethods().contains(oinitAnonym));
assertEquals("No or wrong parent class for initializer " + oinitAnonym.getUniqueName(),
anonymClass, oinitAnonym.getParent());
assertTrue("Anonymous class must contain initializer " + initAnonym.getUniqueName(), anonymClass.getMethods().contains(initAnonym));
assertEquals("No or wrong parent class for initializer " + initAnonym.getUniqueName(),
anonymClass, initAnonym.getParent());
// FamixInvocation Test.<oinit> -> Test$1.<init>
Set<FamixAssociation> lRelations = aModel.getAssociations(oinitTest);
assertTrue("FamixMethod " + oinitTest.getUniqueName() + " must contain relationships", lRelations.size() > 0);
int containsInvocationTo = TestHelper.containsRelationTo(initAnonym, lRelations);
assertEquals("Missing invocation relationship from " + oinitTest.getUniqueName() + " to " + initAnonym.getUniqueName(), 1, containsInvocationTo);
lRelations = aModel.getAssociations(oinitAnonym);
int containsAccessTo = TestHelper.containsRelationTo(anonymAttribute, lRelations);
assertEquals("Missing access relationship from " + oinitAnonym.getUniqueName() + " to " + anonymAttribute.getUniqueName(), 1, containsAccessTo);
}