Package org.evolizer.famix.model.entities

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


    public void testUniqueMethodParamaterContainment() {
        // get all Parameters
        for (AbstractFamixEntity lParameter : aModel.getFamixEntities()) {
            if (lParameter instanceof FamixParameter) {
                // check parameter containers of other behavioural entities to not contain this parameter
                FamixMethod lParentMethod = (FamixMethod) lParameter.getParent();
                assertNotNull("Formal parameter " + lParameter.getUniqueName() + " must have a behavioural entity as parent", lParentMethod);
                for (AbstractFamixEntity lMethod : aModel.getFamixEntities()) {
                    if (lMethod instanceof FamixMethod && lMethod != lParentMethod) {
                        assertFalse("Behavioural entity " + lMethod.getUniqueName() + " must not contain the formal parameter " + lParameter.getUniqueName(),
                                ((FamixMethod) lMethod).getParameters().contains(lParameter));
View Full Code Here


        assertTrue("Missing inheritance relationship in sub class " + baseClass.getUniqueName() + " to " + interfaceClass.getUniqueName(), containsInheritsTo > 0);    
    }

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

        assertNotNull("FamixModel must contain initializer testPackage.InnerAnonym$MemoryMapPool.<init>()", initializer);
        assertNotNull("FamixModel must contain anonymous class testPackage.InnerAnonym$MemoryMapPool$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

                initializer, anonymClass.getParent());
    }

    @Test
    public void testInnerAnonymClassFromInterface() {
        FamixMethod foo = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool.foo(java.lang.String)", null));
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.InnerAnonym$MemoryMapPool$3", null));

        FamixMethod initializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool$3.<oinit>()", null));
        FamixMethod constructor = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool$3.<init>()", null));
        FamixMethod compute = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool$3.compute()", null));
        FamixClass innerAnonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.InnerAnonym$MemoryMapPool$3$1", null));
        FamixMethod innerInitializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool$3$1.<oinit>()", null));
        FamixMethod innerCompute = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool$3$1.compute()", null));
        FamixMethod innerConstructor = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool$3$1.<init>()", null));

        assertNotNull("FamixModel must contain method testPackage.InnerAnonym$MemoryMapPool.foo(java.lang.String)", foo);
        assertNotNull("FamixModel must contain anonymous class testPackage.InnerAnonym$MemoryMapPool$3", anonymClass);
        assertNotNull("FamixModel must contain initializer testPackage.InnerAnonym$MemoryMapPool$3.<oinit>", initializer);
        assertNotNull("FamixModel must contain method testPackage.InnerAnonym$MemoryMapPool$3.<init>", constructor);
        assertNotNull("FamixModel must contain method testPackage.InnerAnonym$MemoryMapPool$3.compute()", compute);

        assertNotNull("FamixModel must contain inner anonymous class testPackage.InnerAnonym$MemoryMapPool$3$1", innerAnonymClass);
        assertNotNull("FamixModel must contain initializer testPackage.InnerAnonym$MemoryMapPool$3$1.<oinit>", innerInitializer);
        assertNotNull("FamixModel must contain method testPackage.InnerAnonym$MemoryMapPool$3$1.compute()", innerCompute);
        assertNotNull("FamixModel must contain method testPackage.InnerAnonym$MemoryMapPool$3$1.<init>", innerConstructor);

        assertTrue("FamixMethod " + foo.getUniqueName() + " must contain anonym class " + anonymClass.getUniqueName(), foo.getAnonymClasses().contains(anonymClass));
        assertEquals("Parent of anonym class " + anonymClass.getUniqueName() + " must be " + foo.getUniqueName(), foo, anonymClass.getParent());
        assertTrue("FamixClass " + anonymClass.getUniqueName() + " must contain method " + compute.getUniqueName(), anonymClass.getMethods().contains(compute));

        Set<FamixAssociation> lRelations = aModel.getAssociations(foo);
        int nrInvocationTo = TestHelper.containsRelationTo(constructor, lRelations);
        assertEquals("Missing invocation relationship from " + foo.getUniqueName() + " to " + constructor.getUniqueName(), 1, nrInvocationTo);

        lRelations = aModel.getAssociations(compute);
        nrInvocationTo = TestHelper.containsRelationTo(innerConstructor, lRelations);
        assertEquals("Missing invocation relationship from " + compute.getUniqueName() + " to " + innerConstructor.getUniqueName(), 1, nrInvocationTo);
    }
View Full Code Here

    }

    @Test
    public void testInnerMethodAnonymousClassContainer() {

        FamixMethod method = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool.clean(java.nio.MappedByteBuffer)", null));
        FamixClass anonymClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.InnerAnonym$MemoryMapPool$2", null));

        assertNotNull("FamixModel must contain method testPackage.InnerAnonym$MemoryMapPool.clean(MappedByteBuffer)", method);
        assertNotNull("FamixModel must contain anonymous class testPackage.InnerAnonym$MemoryMapPool$2", 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

                method, anonymClass.getParent());
    }

    @Test
    public void testAnonymMethodInvocations() {
        FamixMethod caller = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool.clean(java.nio.MappedByteBuffer)", null));
        FamixMethod callee = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.InnerAnonym$MemoryMapPool$2.compute(int,int)", null));

        assertNotNull("FamixModel must contain method testPackage.InnerAnonym$MemoryMapPool.clean(java.nio.MappedByteBuffer)", caller);
        assertNotNull("FamixModel must contain method testPackage.InnerAnonym$MemoryMapPool$2.compute(int,int)", callee);

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

        int containsInvocationTo = TestHelper.containsRelationTo(callee, lRelations);
        assertTrue("Missing invocation relationship from " + caller.getUniqueName() + " to " + callee.getUniqueName(), containsInvocationTo > 0);
    }
View Full Code Here

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

    @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

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

    @Test
    public void testInnerMethodInvocation() {
        FamixMethod caller = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.computeOther(int,java.lang.String)", null));
        FamixMethod callee1 = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.computeOther(java.lang.String)", null));
        FamixMethod callee2 = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.compute()", null));

        assertNotNull("FamixModel must contain method 'testPackage.Base.computeOther(int,java.lang.String)'", caller);
        assertNotNull("FamixModel must contain method 'testPackage.Base.computeOther(java.lang.String)'", callee1);
        assertNotNull("FamixModel must contain method 'testPackage.Base.compute()'", callee2);

        Set<FamixAssociation> lRelations = aModel.getAssociations(caller);
        int containsInvocationTo = TestHelper.containsRelationTo(callee1, lRelations);
        assertEquals("Missing invocation relationship from " + caller.getUniqueName() + " to " + callee1.getUniqueName(), 1, containsInvocationTo);
        containsInvocationTo = TestHelper.containsRelationTo(callee2, lRelations);
        assertEquals("Missing invocation relationship from " + caller.getUniqueName() + " to " + callee2.getUniqueName(), 1, containsInvocationTo);
    }
View Full Code Here

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

    @Test
    public void testMethodInvocation() {
        FamixMethod foo = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.foo()", null));
        FamixMethod callee = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Sum.computeOtherResolved(java.lang.String)", null));

        assertNotNull("FamixModel must contain method 'testPackage.ae.Test.foo()'", foo);
        assertNotNull("FamixModel must contain method 'testPackage.Sum.computeOtherResolved(java.lang.String)'", callee);

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

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

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

    @Test
    public void testMethodInvocationParamIsSubtype() {
        FamixMethod caller = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.getParamSum()", null));
        FamixMethod callee = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Variables.getSum(testPackage.IBase)", null));

        assertNotNull("FamixModel must contain method 'testPackage.ae.Test.getParamSum()'", caller);
        assertNotNull("FamixModel must contain method 'testPackage.Variables.getSum(testPackage.IBase)'", callee);

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

        int containsInvocationTo = TestHelper.containsRelationTo(callee, lRelations);
        assertTrue("Missing invocation relationship from " + caller.getUniqueName() + " to " + callee.getUniqueName(), containsInvocationTo > 0);
    }
View Full Code Here

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

    @Test
    public void testMethodInvocationCallSequence() {
        FamixMethod caller = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.callSequence()", null));
        FamixMethod callee1 = (FamixMethod) aModel.getElement(aFactory.createMethod("java.util.Vector<E>.elementAt(int)", null));
        FamixMethod callee2 = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Sum.compute()", null));

        assertNotNull("FamixModel must contain method 'testPackage.ae.Test.getParamSum()'", caller);
        assertNotNull("FamixModel must contain method 'java.util.Vector<E>.elementAt(int)'", callee1);
        assertNotNull("FamixModel must contain method 'testPackage.Sum.compute()'", callee2);

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

        int containsInvocationTo = TestHelper.containsRelationTo(callee1, lRelations);
        assertEquals("Missing invocation relationship from " + caller.getUniqueName() + " to " + callee1.getUniqueName(), 1, containsInvocationTo);
        containsInvocationTo = TestHelper.containsRelationTo(callee2, lRelations);
        assertEquals("Missing invocation relationship from " + caller.getUniqueName() + " to " + callee2.getUniqueName(), 1, containsInvocationTo);
    }
View Full Code Here

TOP

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

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.