Package org.evolizer.famix.model.entities

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


                simpleAttribute.getDeclaredClass(), classInt);
    }

    @Test
    public void testRefAttributeType() {
        FamixClass classSum = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.Sum", null));
        FamixAttribute refAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Variables.refSum", null));
        assertEquals("Declared class of " + refAttribute.getUniqueName() + " must be testPackage.Sum",
                refAttribute.getDeclaredClass(), classSum);

    }
View Full Code Here


    }

    @Test
    public void testParameterizedAttributeType() {
        FamixClass classVector = (FamixClass) aModel.getElement(aFactory.createClass("java.util.Vector<E>", null));
        FamixAttribute paramAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Variables.containerSum", null));
        assertEquals("Declared class of " + paramAttribute.getUniqueName() + " must be java.util.Vector<E>",
                paramAttribute.getDeclaredClass(), classVector);

    }
View Full Code Here

    }

    @Test
    public void testArrayAttributeType() {
        FamixClass classArray = (FamixClass) aModel.getElement(aFactory.createClass("<Array>", null));
        FamixAttribute arrayAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Variables.arraySum", null));
        assertEquals("Declared class of " + arrayAttribute.getUniqueName() + " must be " + classArray.getUniqueName(),
                arrayAttribute.getDeclaredClass(), classArray);
    }
View Full Code Here

        setASTNode(anonymTypeDeclaration);
        setTypeBinding(getASTNode().resolveBinding());

        try {
            addCurrTypeToTypeReminder();
            FamixClass lCurrType = getClass(getTypeBinding(), null, true);
            // if (lCurrType.getParent() != null) {
            // logger.error("Anonymous type conflict - skipping the type: " + lCurrType.getUniqueName() + " in method "
            // + getCurrMethod().getUniqueName());
            // // return true;
            // }
            lCurrType = (FamixClass) getModel().addElement(lCurrType);
            lCurrType.setSourceAnchor(getSourceAnchor());
            setCurrType(lCurrType);

            // also keep a counter for nested anonymous classes
            getAnonymClassCounter().put(getCurrType(), 0);
View Full Code Here

    }

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

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

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

     * dependency.
     * 
     * {@inheritDoc}
     */
    public void addInheritanceLinks() {
        FamixClass lImplementedType = null;
        if (getTypeBinding() != null) {
            if (getTypeBinding().getInterfaces().length != 0) {
                // An anonymous class can implement only 1 interface
                lImplementedType = getClass(getTypeBinding().getInterfaces()[0], null, false);
                lImplementedType = (FamixClass) getModel().addElement(lImplementedType);
                lImplementedType.setModifiers(lImplementedType.getModifiers() | AbstractFamixEntity.MODIFIER_INTERFACE);
                FamixAssociation subtyping = getFactory().createSubtyping(getCurrType(), lImplementedType);
                subtyping.setSourceAnchor(getSourceAnchor());
                getModel().addRelation(subtyping);
            } else {
                lImplementedType = getClass(getTypeBinding().getSuperclass(), null, false);
View Full Code Here

        assertTrue("Missing castTo relationship from " + method.getUniqueName() + " to " + classSum.getUniqueName(), containsRelTo);
    }

    @Test
    public void testInnerClasses() {
        FamixClass parentClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test", null));
        FamixClass innerClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$Inner", null));
        FamixClass innerInnerClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$Inner$InnerInner", null));

        assertEquals("No or wrong parent class for inner class testPackage.ae.Test$Inner", parentClass, innerClass.getParent());
        assertEquals("No or wrong parent class for inner inner class testPackage.ae.Test$Inner$InnerInner", innerClass, innerInnerClass.getParent());      
        assertTrue("Parent class testPackage.ae.Test must contain inner classes", parentClass.getInnerClasses().size() > 0);
        assertTrue("Inner class testPackage.ae.Test$Inner must contain an inner class", innerClass.getInnerClasses().size() > 0);      
    }
View Full Code Here

        assertTrue("Inner class testPackage.ae.Test$Inner must contain an inner class", innerClass.getInnerClasses().size() > 0);      
    }

    @Test
    public void testClassMethodConainer() {
        FamixClass parentClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test", null));
        FamixMethod simpleMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.foo()", null));

        assertTrue("FamixClass must contain simple method foo()", parentClass.getMethods().contains(simpleMethod));
        assertEquals("No or wrong parent class for method foo()", parentClass, simpleMethod.getParent());
    }
View Full Code Here

        assertEquals("No or wrong parent class for method foo()", parentClass, simpleMethod.getParent());
    }

    @Test
    public void testClassAttributeContainer() {
        FamixClass parentClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test", null));
        FamixAttribute simpleAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.ae.Test.a", null));

        assertTrue("FamixClass must contain simple attribute a", parentClass.getAttributes().contains(simpleAttribute));
        assertEquals("No or wrong parent class for attribute a", parentClass, simpleAttribute.getParent());
    }
View Full Code Here

        assertEquals("No or wrong parent class for attribute a", parentClass, simpleAttribute.getParent());
    }

    @Test
    public void testInnerClassMethodContainer() {
        FamixClass innerClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$Inner", null));
        FamixMethod innerMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$Inner.innerMethod()", null));

        assertTrue("Inner class must contain method " + innerMethod.getUniqueName(), innerClass.getMethods().contains(innerMethod));
        assertEquals("No or wrong parent class for inner class method " + innerMethod.getUniqueName(),
                innerClass, innerMethod.getParent());
    }
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.