Examples of FamixMethod


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

        assertEquals("Missing invocation relationship from " + caller.getUniqueName() + " to " + callee2.getUniqueName(), 1, containsInvocationTo);
    }

    @Test
    public void testSuperMethodInvocation() {
        FamixMethod caller = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Sum.computeOtherResolved(java.lang.String)", null));
        FamixMethod superMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.computeOther(java.lang.String)", null));

        assertNotNull("FamixModel must contain method 'testPackage.Sum.computeOtherResolved(java.lang.String)'", caller);
        assertNotNull("FamixModel must contain method 'testPackage.Base.computeOther(java.lang.String)'", superMethod);

        Set<FamixAssociation> lRelations = aModel.getAssociations(caller);
        assertTrue("FamixMethod " + caller.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        int containsInvocationTo = TestHelper.containsRelationTo(superMethod, lRelations);
        assertTrue("Missing super method invocation relationship from " + caller.getUniqueName() + " to " + superMethod.getUniqueName(), containsInvocationTo > 0);

        lRelations = aModel.getAssociations(superMethod);
        assertTrue("FamixMethod " + superMethod.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        containsInvocationTo = TestHelper.containsRelationTo(superMethod, lRelations);
        assertTrue("Missing super method invocation relationship from " + caller.getUniqueName() + " to " + superMethod.getUniqueName(), containsInvocationTo > 0);
    }
View Full Code Here

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

        assertTrue("Missing super method invocation relationship from " + caller.getUniqueName() + " to " + superMethod.getUniqueName(), containsInvocationTo > 0);
    }

    @Test
    public void testSuperConstructorInvocation() {
        FamixMethod caller = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Sum.<init>()", null));
        FamixMethod superConstructor = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.<init>()", null));

        Set<FamixAssociation> lRelations = aModel.getAssociations(caller);
        assertTrue("FamixMethod " + caller.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        int containsInvocationTo = TestHelper.containsRelationTo(superConstructor, lRelations);
        assertTrue("Missing super constructor invocation relationship from " + caller.getUniqueName() + " to " + superConstructor.getUniqueName(), containsInvocationTo > 0);

        lRelations = aModel.getAssociations(superConstructor);
        assertTrue("FamixMethod " + superConstructor.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        containsInvocationTo = TestHelper.containsRelationTo(superConstructor, lRelations);
        assertTrue("Missing super constructor invocation relationship from " + caller.getUniqueName() + " to " + superConstructor.getUniqueName(), containsInvocationTo > 0);
    }
View Full Code Here

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

        assertTrue("Missing super constructor invocation relationship from " + caller.getUniqueName() + " to " + superConstructor.getUniqueName(), containsInvocationTo > 0);
    }

    @Test
    public void testAttributeInitialization() {
        FamixMethod testInit = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.<oinit>()", null));
        FamixAttribute simpleAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.ae.Test.c", null));
        Set<FamixAssociation> lRelations = aModel.getAssociations(testInit);
        assertTrue("FamixMethod " + testInit.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        int containsAccessTo = TestHelper.containsRelationTo(simpleAttribute, lRelations);
        assertTrue("Missing access relationship from " + testInit.getUniqueName() + " to " + simpleAttribute.getUniqueName(), containsAccessTo > 0);

        FamixMethod baseInit = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.<oinit>()", null));
        FamixAttribute baseAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Base.a", null));
        lRelations = aModel.getAssociations(baseInit);
        assertTrue("FamixMethod " + baseInit.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        containsAccessTo = TestHelper.containsRelationTo(baseAttribute, lRelations);
        assertTrue("Missing access relationship from " + baseInit.getUniqueName() + " to " + baseAttribute.getUniqueName(), containsAccessTo > 0);
    }
View Full Code Here

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

        assertTrue("Missing access relationship from " + baseInit.getUniqueName() + " to " + baseAttribute.getUniqueName(), containsAccessTo > 0);
    }

    @Test
    public void testThisAttributeAccess() {
        FamixMethod accessorMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Variables.fieldAccess()", null));
        FamixAttribute simpleAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Variables.field", null));

        Set<FamixAssociation> lRelations = aModel.getAssociations(accessorMethod);
        assertTrue("FamixMethod " + accessorMethod.getUniqueName() + " must contain relationships", lRelations.size() > 0);

        int containsInvocationTo = TestHelper.containsRelationTo(simpleAttribute, lRelations);
        assertEquals("Missing access relationship from " + accessorMethod.getUniqueName() + " to " + simpleAttribute.getUniqueName(), 1, containsInvocationTo);
    }
View Full Code Here

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

        assertEquals("Missing access relationship from " + accessorMethod.getUniqueName() + " to " + simpleAttribute.getUniqueName(), 1, containsInvocationTo);
    }

    @Test
    public void testQualifiedFieldAccess() {
        FamixMethod accessorMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Variables.fieldAccess()", null));
        FamixAttribute simpleAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Sum.publicField", null));

        Set<FamixAssociation> lRelations = aModel.getAssociations(accessorMethod);
        assertTrue("FamixMethod " + accessorMethod.getUniqueName() + " must contain relationships", lRelations.size() > 0);

        int containsInvocationTo = TestHelper.containsRelationTo(simpleAttribute, lRelations);
        assertEquals("Missing access relationship from " + accessorMethod.getUniqueName() + " to " + simpleAttribute.getUniqueName(), 2, containsInvocationTo);
    }
View Full Code Here

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

        assertEquals("Missing access relationship from " + accessorMethod.getUniqueName() + " to " + simpleAttribute.getUniqueName(), 2, containsInvocationTo);
    }

    @Test
    public void testFieldAccessBySimpleName() {
        FamixMethod accessorMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Variables.fieldAccess()", null));
        FamixAttribute simpleAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Variables.fInit", null));

        assertNotNull("FamixModel must contain method testPackage.Variables.fieldAccess()", accessorMethod);
        assertNotNull("FamixModel must contain attribute testPackage.Variables.fInit", simpleAttribute);

        Set<FamixAssociation> lRelations = aModel.getAssociations(accessorMethod);
        assertTrue("FamixMethod " + accessorMethod.getUniqueName() + " must contain relationships", lRelations.size() > 0);

        int containsInvocationTo = TestHelper.containsRelationTo(simpleAttribute, lRelations);
        assertEquals("Missing access relationship from " + accessorMethod.getUniqueName() + " to " + simpleAttribute.getUniqueName(), 1, containsInvocationTo);
    }
View Full Code Here

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

        assertEquals("Missing access relationship from " + accessorMethod.getUniqueName() + " to " + simpleAttribute.getUniqueName(), 1, containsInvocationTo);
    }

    @Test
    public void testClassInstanceCreation() {
        FamixMethod caller = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.computeSum()", null));
        FamixMethod constructor = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Sum.<init>(int,int)", null));

        Set<FamixAssociation> lRelations = aModel.getAssociations(caller);
        assertTrue("FamixMethod " + caller.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        int containsInvocationTo = TestHelper.containsRelationTo(constructor, lRelations);
        assertTrue("Missing instance creation invocation relationship from " + caller.getUniqueName() + " to " + constructor.getUniqueName(), containsInvocationTo > 0);

        lRelations = aModel.getAssociations(constructor);
        assertTrue("FamixMethod " + constructor.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        containsInvocationTo = TestHelper.containsRelationTo(constructor, lRelations);
        assertTrue("Missing instance creation invocation relationship from " + caller.getUniqueName() + " to " + constructor.getUniqueName(), containsInvocationTo > 0);
    }
View Full Code Here

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

    }

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

        FamixMethod innerConstructor = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$Inner.<init>()", null));
        Set<FamixAssociation> lRelations = aModel.getAssociations(caller);
        assertTrue("FamixMethod " + caller.getUniqueName() + " must contain relationships", lRelations.size() > 0);

        // invokes Inner class constructor
        boolean containsInvocationTo = TestHelper.containsRelationTo(new FamixInvocation(caller, innerConstructor), lRelations);
        assertTrue("Missing constructor invocation relationship from " + caller.getUniqueName() + " to " + innerConstructor.getUniqueName(), containsInvocationTo);

        // invokes innerMethod
        containsInvocationTo = TestHelper.containsRelationTo(new FamixInvocation(caller, innerMethod), lRelations);
        assertTrue("Missing invocation relationship from " + caller.getUniqueName() + " to " + innerMethod.getUniqueName(), containsInvocationTo);
    }
View Full Code Here

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

        assertTrue("Missing invocation relationship from " + caller.getUniqueName() + " to " + innerMethod.getUniqueName(), containsInvocationTo);
    }

    @Test
    public void testMethodLocalVariableContainsSimple() {
        FamixMethod simpleMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Variables.m(int,int[])", null));
        FamixLocalVariable simpleLocal = aFactory.createLocalVariable("testPackage.Variables.m(int,int[]).local", null);
        simpleLocal.setSourceAnchor(new SourceAnchor("/TestProject1/src/testPackage/Variables.java", 0, 436));
        simpleLocal = (FamixLocalVariable) aModel.getElement(simpleLocal);

        assertNotNull("FamixModel must contain local variable testPackage.Variables.m(int,int[]).local", simpleLocal);
        assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);
        boolean containsLocal = TestHelper.containsLocalVariable(simpleMethod, simpleLocal);
        assertTrue("FamixMethod must contain local variable simpleLocal", containsLocal);
        assertEquals("No or wrong parent method for local variable simpleLocal", simpleMethod, simpleLocal.getParent());
    }
View Full Code Here

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

        assertEquals("No or wrong parent method for local variable simpleLocal", simpleMethod, simpleLocal.getParent());
    }

    @Test
    public void testMethodLocalVariableContainsMulti() {
        FamixMethod simpleMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Variables.m(int,int[])", null));
        FamixLocalVariable multiLocal1 = aFactory.createLocalVariable("testPackage.Variables.m(int,int[]).multi1", null);
        multiLocal1.setSourceAnchor(new SourceAnchor("/TestProject1/src/testPackage/Variables.java", 0, 450));
        multiLocal1 = (FamixLocalVariable) aModel.getElement(multiLocal1);
        FamixLocalVariable multiLocal2 = aFactory.createLocalVariable("testPackage.Variables.m(int,int[]).multi2", null);
        multiLocal2.setSourceAnchor(new SourceAnchor("/TestProject1/src/testPackage/Variables.java", 0, 458));
        multiLocal2 = (FamixLocalVariable) aModel.getElement(multiLocal2);

        assertNotNull("FamixModel must contain local variable testPackage.Variables.m(int,int[]).multi1", multiLocal1);
        assertNotNull("FamixModel must contain local variable testPackage.Variables.m(int,int[]).multi2", multiLocal2);
        assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);

        boolean containsLocal1 = TestHelper.containsLocalVariable(simpleMethod, multiLocal1);
        assertTrue("FamixMethod must contain local variable multiLocal1", containsLocal1);
        assertEquals("No or wrong parent method for local variable multiLocal1", simpleMethod, multiLocal1.getParent());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.