Examples of FamixMethod


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

                        System.err.println("Var data type not contained in model: " + var.getUniqueName());
                    }
                }
            }
            if (entity instanceof FamixMethod) {
                FamixMethod func = (FamixMethod) entity;
                if (func.getDeclaredReturnClass() == null) {
                    System.err.println("No return type: " + func.getUniqueName());
                } else {
                    if (! aModel.contains(func)) {
                        System.err.println("Return type not contained in model: " + func.getUniqueName());
                    }
                }
            }
        }
    }
View Full Code Here

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

        }
    }

    @Test
    public void testInitializerAnonymousClassContainer() {
        FamixMethod initializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.<oinit>()", null));
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$1", null));

        assertNotNull("FamixModel must contain initializer testPackage.ae.Test.<oinit>()", initializer);
        assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$1", anonymClass);

        assertTrue("FamixMethod must contain anonymous class " + anonymClass.getUniqueName(), initializer.getAnonymClasses().contains(anonymClass));
        assertEquals("No or wrong parent method for anonymous class " + anonymClass.getUniqueName(),
                initializer, anonymClass.getParent());
    }
View Full Code Here

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

                initializer, anonymClass.getParent());
    }

    @Test
    public void testMethodAnonymousClassContainer() {
        FamixMethod method = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.containsAnonymClass()", null));
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$3", null));

        assertNotNull("FamixModel must contain initializer testPackage.ae.Test.containsAnonymClass()", method);
        assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$3", anonymClass);

        assertTrue("FamixMethod must contain anonymous class " + anonymClass.getUniqueName(), method.getAnonymClasses().contains(anonymClass));
        assertEquals("No or wrong parent method for anonymous class " + anonymClass.getUniqueName(),
                method, anonymClass.getParent());
    }
View Full Code Here

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

    }

    @Test
    public void testAnonymousClassMethodContainer() {
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test$1", null));
        FamixMethod initializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$1.<oinit>()", null));
        FamixMethod computeMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$1.compute()", null));

        assertNotNull("FamixModel must contain anonymous class testPackage.ae.Test$1", anonymClass);
        assertNotNull("FamixModel must contain anonymous class initializer testPackage.ae.Test$1.<oinit>()", initializer);
        assertNotNull("FamixModel must contain ananymous class method testPackage.ae.Test$1.compute()", computeMethod);

        assertTrue("Anonymous class must contain initializer " + initializer.getUniqueName(), anonymClass.getMethods().contains(initializer));
        assertEquals("No or wrong parent class for initializer " + initializer.getUniqueName(),
                anonymClass, initializer.getParent());

        assertTrue("Anonymous class must contain method " + computeMethod.getUniqueName(), anonymClass.getMethods().contains(computeMethod));
        assertEquals("No or wrong parent class for method " + computeMethod.getUniqueName(),
                anonymClass, computeMethod.getParent());
    }
View Full Code Here

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

    }

    @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);
    }
View Full Code Here

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

        assertEquals("Missing access relationship from " + oinitAnonym.getUniqueName() + " to " + anonymAttribute.getUniqueName(), 1, containsAccessTo);
    }

    @Test
    public void testInvocationAnonymClassMethod() {
        FamixMethod containsAnonymMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.containsAnonymClass()", null));
        FamixMethod baseMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.getA()", null));
        FamixMethod sumComputeMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Sum.compute()", null));
        FamixMethod anonymComputeMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$3.compute()", null));
        FamixMethod doubleItMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test$3.doubleIt()", null));

        assertNotNull("FamixModel must contain method testPackage.ae.Test.containsAnonymClass()", containsAnonymMethod);
        assertNotNull("FamixModel must contain method testPackage.Base.getA()", baseMethod);
        assertNotNull("FamixModel must contain method testPackage.Sum.compute()", sumComputeMethod);
        assertNotNull("FamixModel must contain method testPackage.ae.Test$3.compute()", anonymComputeMethod);
        assertNotNull("FamixModel must contain method testPackage.ae.Test$3.doubleIt()", doubleItMethod);

        // containsAnonymClass() -> Sum.compute() (determined at run-time)
        Set<FamixAssociation> lRelations = aModel.getAssociations(containsAnonymMethod);
        assertTrue("FamixMethod " + containsAnonymMethod.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        int containsInvocationTo = TestHelper.containsRelationTo(sumComputeMethod, lRelations);
        assertTrue("Missing invocation relationship from " + containsAnonymMethod.getUniqueName() + " to " + sumComputeMethod.getUniqueName(), containsInvocationTo > 0);

        // Test$3.compute() -> Sum.getA()
        lRelations = aModel.getAssociations(anonymComputeMethod);
        assertTrue("FamixMethod " + sumComputeMethod.getUniqueName() + " must contain relationships", lRelations.size() > 0);
        containsInvocationTo = TestHelper.containsRelationTo(baseMethod, lRelations);
        assertTrue("Missing invocation relationship from " + anonymComputeMethod.getUniqueName() + " to " + baseMethod.getUniqueName(), containsInvocationTo > 0);
        // Test$3.compute() -> Test$3.doubleIt()
        containsInvocationTo = TestHelper.containsRelationTo(doubleItMethod, lRelations);
        assertTrue("Missing invocation relationship from " + anonymComputeMethod.getUniqueName() + " to " + doubleItMethod.getUniqueName(), containsInvocationTo > 0);
    }
View Full Code Here

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

                staticFinalAttribute.getModifiers() & Modifier.FINAL, Modifier.FINAL);
    }

    @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

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

    }

    @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

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

    }

    @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

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

                innerClass, innerAttribute.getParent());
    }

    @Test
    public void testMethodParameterConainer() {
        FamixMethod simpleMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Variables.m(int,int[])", null));
        FamixParameter simpleParam = (FamixParameter) aModel.getElement(aFactory.createFormalParameter("testPackage.Variables.m(int,int[]).param", null, 0));

        assertTrue("FamixMethod must contain formal parameters", simpleMethod.getParameters().size() > 0);
        assertNotNull("FamixMethod must contain formal parameter testPackage.Variables.m(int,int[]).param", simpleParam);

        boolean containsParam = false;
        for (FamixParameter lParam : simpleMethod.getParameters()) {
            if (lParam.getUniqueName().equals(simpleParam.getUniqueName())) {
                containsParam = true;
                break;
            }
        }
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.