Package org.evolizer.famix.model.entities

Examples of org.evolizer.famix.model.entities.FamixClass


    }

    @Test
    public void testInstanceOf() {
        FamixMethod method = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.computeAllSums()", null));
        FamixClass classSum = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.Sum", null));

        // check metho rel. container
        Set<FamixAssociation> lRelations = aModel.getAssociations(method);
        assertTrue("FamixMethod " + method.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        boolean containsRelTo = TestHelper.containsRelationTo(new FamixCheckInstanceOf(method, classSum), lRelations);
        assertTrue("Missing instanceOf relationship from " + method.getUniqueName() + " to " + classSum.getUniqueName(), containsRelTo);

        // check instanOf class rel. container
        lRelations = aModel.getAssociations(classSum);
        assertTrue("FamixClass " + classSum.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        containsRelTo = TestHelper.containsRelationTo(new FamixCheckInstanceOf(method, classSum), lRelations);
        assertTrue("Missing instanceOf relationship from " + method.getUniqueName() + " to " + classSum.getUniqueName(), containsRelTo);
    }
View Full Code Here


        assertEquals("No or wrong parent method for local variable inFor within for loop", simpleMethod, withinCatch.getParent());
    }

    @Test
    public void testMethodReturnTypeVoid() {
        FamixClass classVoid = (FamixClass) aModel.getElement(aFactory.createClass("void", null));
        FamixMethod returnVoid = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.foo()", null));
        assertEquals("Return type of " + returnVoid.getUniqueName() + " must be void",
                returnVoid.getDeclaredReturnClass(), classVoid);
    }
View Full Code Here

                returnVoid.getDeclaredReturnClass(), classVoid);
    }

    @Test
    public void testMethodReturnTypePrimitive() {
        FamixClass classInt = (FamixClass) aModel.getElement(aFactory.createClass("int", null));
        FamixMethod returnPrimitive = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.computeSum()", null));
        assertEquals("Return type of " + returnPrimitive.getUniqueName() + " must be " + classInt.getUniqueName(),
                returnPrimitive.getDeclaredReturnClass(), classInt);
    }
View Full Code Here

                returnPrimitive.getDeclaredReturnClass(), classInt);
    }

    @Test
    public void testMethodReturnTypeRef() {
        FamixClass classSum = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.Sum", null));
        FamixMethod returnRef = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.getRefSum()", null));
        assertNotNull("FamixModel must contain testPackage.Sum", classSum);
        assertEquals("Return type of " + returnRef.getUniqueName() + " must be " + classSum.getUniqueName(),
                returnRef.getDeclaredReturnClass(), classSum);
    }
View Full Code Here

                returnRef.getDeclaredReturnClass(), classSum);
    }

    @Test
    public void testMethodReturnTypeContainer() {
        FamixClass classVector = (FamixClass) aModel.getElement(aFactory.createClass("java.util.Vector<E>", null));
        FamixMethod returnContainer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.getContainerSum()", null));
        assertNotNull("FamixModel must contain java.util.Vector<E>", classVector);
        assertEquals("Return type of " + returnContainer.getUniqueName() + " must be " + classVector.getUniqueName(),
                returnContainer.getDeclaredReturnClass(), classVector);
    }
View Full Code Here

    }
  }
 
  @Test
  public void testUnresolvedInheritance() {
    FamixClass clazz = (FamixClass)fModel.getElement(fFactory.createClass("testPackage.Test",null));
    assertNotNull(clazz);
    FamixClass superClass = (FamixClass) fModel.getElement(fFactory.createClass("<undef>.SomeClass",null));
    assertNotNull(superClass);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(superClass);
    assertTrue("FamixClass " + superClass.getUniqueName() + " must contain relationships", lRelations.size() > 0);
    int containsInheritsTo = TestHelper.containsRelationTo(superClass, lRelations);
    assertTrue("Missing inheritance relationship in base class" + clazz.getUniqueName() + " to " + superClass.getUniqueName(), containsInheritsTo > 0);
   
    lRelations = fModel.getAssociations(clazz);
    assertTrue("FamixClass " + clazz.getUniqueName() + " must contain relationships", lRelations.size() > 0);
    containsInheritsTo = TestHelper.containsRelationTo(superClass, lRelations);
    assertTrue("Missing inheritance relationship in sub class " + clazz.getUniqueName() + " to " + superClass.getUniqueName(), containsInheritsTo > 0);
  }
View Full Code Here

                returnContainer.getDeclaredReturnClass(), classVector);
    }

    @Test
    public void testMethodReturnTypeArray() {
        FamixClass classArray = (FamixClass) aModel.getElement(aFactory.createClass("<Array>", null));
        FamixMethod returnArray = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.getArraySum()", null));
        assertNotNull("FamixModel must contain testPackage.Sum", classArray);
        assertEquals("Return type of " + returnArray.getUniqueName() + " must be <Array>",
                returnArray.getDeclaredReturnClass(), classArray);
    }
View Full Code Here

                returnArray.getDeclaredReturnClass(), classArray);
    }

    @Test
    public void testConstructor() {
        FamixClass classBase = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.Base", null));
        FamixMethod initializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.<init>()", null));

        assertNotNull("FamixModel must contain initializer", initializer);

        boolean containsMethod = false;
        for (FamixMethod method : classBase.getMethods()) {
            if (method.getUniqueName().equals(initializer.getUniqueName())) {
                containsMethod = true;
            }
        }
        assertTrue("FamixClass testPackage.Base must contain initializer " + initializer.getUniqueName(), containsMethod);
View Full Code Here

        assertEquals("Parent class of " + initializer.getUniqueName() + " must be testPackage.Base", initializer.getParent(), classBase);
    }

    @Test
    public void testInitializer() {
        FamixClass classTest = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test", null));
        FamixMethod initializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.<init>()", null));

        assertNotNull("FamixModel must contain initializer", initializer);

        boolean containsMethod = false;
        for (FamixMethod method : classTest.getMethods()) {
            if (method.getUniqueName().equals(initializer.getUniqueName())) {
                containsMethod = true;
            }
        }
        assertTrue("FamixClass testPackage.ae.Test must contain initializer " + initializer.getUniqueName(), containsMethod);
View Full Code Here

    assertTrue("Missing inheritance relationship in sub class " + clazz.getUniqueName() + " to " + superClass.getUniqueName(), containsInheritsTo > 0);
  }
 
  @Test
  public void testUnresolvedInterfaces(){
    FamixClass interfaceClass = (FamixClass) fModel.getElement(fFactory.createClass("<undef>.SomeInterface",null));
    FamixClass baseClass = (FamixClass) fModel.getElement(fFactory.createClass("testPackage.Test",null));
    assertNotNull(interfaceClass);
    assertNotNull(baseClass);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(baseClass);
    assertTrue("FamixClass " + baseClass.getUniqueName() + " must contain relationships", lRelations.size() > 0);
    int containsInheritsTo = TestHelper.containsRelationTo(interfaceClass, lRelations);
    assertTrue("Missing inheritance relationship in class" + baseClass.getUniqueName() + " to " + interfaceClass.getUniqueName(), containsInheritsTo > 0);
   
    lRelations = fModel.getAssociations(interfaceClass);
    assertTrue("FamixClass " + interfaceClass.getUniqueName() + " must contain relationships", lRelations.size() > 0);
    containsInheritsTo = TestHelper.containsRelationTo(interfaceClass, lRelations);
    assertTrue("Missing inheritance relationship in sub class " + baseClass.getUniqueName() + " to " + interfaceClass.getUniqueName(), containsInheritsTo > 0);
  }
View Full Code Here

TOP

Related Classes of org.evolizer.famix.model.entities.FamixClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.