Examples of FamixMethod


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

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

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

        assertNotNull("FamixModel must contain method testPackage.Variables.m(int,int[])", simpleMethod);
        assertNotNull("FamixModel must contain local variable testPackage.Variables.m(int,int[]).inFor", withinFor);

        assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);

        boolean containsLocal = TestHelper.containsLocalVariable(simpleMethod, withinFor);
        assertTrue("FamixMethod must contain local variable inFor within for loop", containsLocal);
        assertEquals("No or wrong parent method for local variable inFor within for loop", simpleMethod, withinFor.getParent());
    }
View Full Code Here

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

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

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

        assertNotNull("FamixModel must contain method testPackage.Variables.m(int,int[])", simpleMethod);
        assertNotNull("FamixModel must contain local variable testPackage.Variables.m(int,int[]).aiob", withinCatch);

        assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);

        boolean containsLocal = TestHelper.containsLocalVariable(simpleMethod, withinCatch);
        assertTrue("FamixMethod must contain local variable inFor within for loop", containsLocal);
        assertEquals("No or wrong parent method for local variable inFor within for loop", simpleMethod, withinCatch.getParent());
    }
View Full Code Here

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

    }

    @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

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

    }

    @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

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

    }

    @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

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

    }

    @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

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

    }

    @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

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

    }

    @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);
        assertEquals("Parent class of " + initializer.getUniqueName() + " must be testPackage.Base", initializer.getParent(), classBase);
    }
View Full Code Here

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

    }

    @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);
        assertEquals("Parent class of " + initializer.getUniqueName() + " must be testPackage.ae.Test", initializer.getParent(), classTest);
    }
View Full Code Here

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

        }
  }

  @Test
  public void testCallUndefType() {
    FamixMethod caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls.callUndefType()", null));
    assertNotNull("FamixModel must contain method testPackage.UnresolvedCalls.callUndefType()", caller);
    FamixMethod callee = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.undefMethod()", null));
    assertNotNull("FamixModel must contain method <undef>.NotDef.undefMethod()", callee);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(caller);
    int nrContainsInvocation = TestHelper.containsRelationTo(callee, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
   
    callee = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef2.undefMethod()", null));
    assertNotNull("FamixModel must contain method <undef>.NotDef2.undefMethod()", callee);
    nrContainsInvocation = TestHelper.containsRelationTo(callee, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 2, nrContainsInvocation);
   
    caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls.callUndefType(<undef>.NotDef)", null));
    assertNotNull("FamixModel must contain method testPackage.UnresolvedCalls.callUndefType(<undef>.NotDef)", caller);
    callee = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.undefParameter()", null));
    assertNotNull("FamixModel must contain method <undef>.NotDef.undefParameter()", callee);

    lRelations = fModel.getAssociations(caller);
    nrContainsInvocation = TestHelper.containsRelationTo(callee, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
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.