Package org.evolizer.famix.model.entities

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


    }

    @Test
    public void testStaticInitializer() {
        FamixClass classTest = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.ae.Test", null));
        FamixMethod staticInitializer = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.ae.Test.<clinit>()", null));

        assertNotNull("FamixModel must contain a static initializer", staticInitializer);

        boolean containsMethod = false;
        for (FamixMethod method : classTest.getMethods()) {
            if (method.getUniqueName().equals(staticInitializer.getUniqueName())) {
                containsMethod = true;
            }
        }
        assertTrue("FamixClass testPackage.ae.Test must contain static initializer " + staticInitializer.getUniqueName(), containsMethod);
        assertEquals("Parent class of static initializer " + staticInitializer.getUniqueName() + " must be testPackage.ae.Test", staticInitializer.getParent(), classTest);
    }
View Full Code Here


    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
 
  @Test
  public void testCallUndefTypeAndAttribute() {
    FamixMethod caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls.undefTypeAndAttribute()", null));
    FamixMethod callee = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.undefMethod(int,java.lang.String,<undef>.NotDef2)", null));

    assertNotNull("Callee method <undef>.NotDef.undefMethod(int,java.lang.String,<undef>.NotDef2) must exist", callee);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(caller);
    int nrContainsInvocation = TestHelper.containsRelationTo(callee, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
View Full Code Here

    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }

  @Test
  public void testUndefAttributeAfterMethod() {
    FamixMethod caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls.undefAttributeAfterMethod()", null));
    FamixMethod callee = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.undefMethod(<undef>.NotDef2,<undef>.NotDef3)", null));

    assertNotNull("Callee method <undef>.NotDef.undefMethod(<undef>.NotDef2,<undef>.NotDef3) must exist", callee);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(caller);
    int nrContainsInvocation = TestHelper.containsRelationTo(callee, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
View Full Code Here

    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }

  @Test
  public void testCallOverwrittenVariable() {
    FamixMethod caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls.callOverwrittenVariable()", null));
    FamixMethod callee = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.undefMethod(int,java.lang.String)", null));

    assertNotNull("Callee method <undef>.NotDef.undefMethod(int,java.lang.String) must exist", callee);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(caller);
    int nrContainsInvocation = TestHelper.containsRelationTo(callee, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
View Full Code Here

    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
 
  @Test
  public void testVariableScopeInnerClass() {
    FamixMethod caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls$inner.variableScope(int)", null));
    FamixMethod callee = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.undefMethod(<undef>.NotDef2)", null));

    assertNotNull("Callee method <undef>.NotDef.undefMethod(<undef>.NotDef2) must exist", callee);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(caller);
    int nrContainsInvocation = TestHelper.containsRelationTo(callee, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
View Full Code Here

        assertEquals("Parent class of static initializer " + staticInitializer.getUniqueName() + " must be testPackage.ae.Test", staticInitializer.getParent(), classTest);
    }

    @Test
    public void testMethodModifiers() {
        FamixMethod publicAbstractMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Base.compute()", null));
        assertEquals("Type string of " + publicAbstractMethod.getUniqueName() + " must have modifier PUBLIC",
                publicAbstractMethod.getModifiers() & Modifier.PUBLIC, Modifier.PUBLIC);
        assertEquals("Type string of " + publicAbstractMethod.getUniqueName() + " must have modifier ABSTRACT",
                publicAbstractMethod.getModifiers() & Modifier.ABSTRACT, Modifier.ABSTRACT);
    }
View Full Code Here

    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }

  @Test
  public void testUndefNestedCall() {
    FamixMethod caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls.nestedCall()", null));
    FamixMethod callee1 = (FamixMethod) fModel.getElement(fFactory.createMethod("java.io.PrintStream.println(<undef>)", null));
    FamixMethod callee2 = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.toString()", null));
   
    assertNotNull("Callee method java.io.PrintStream.println(<undef>) must exist", callee1);
    assertNotNull("Callee method <undef>.NotDef.toString() must exist", callee2);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(caller);
    int nrContainsInvocation = TestHelper.containsRelationTo(callee1, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee1.getUniqueName(), 1, nrContainsInvocation);

    nrContainsInvocation = TestHelper.containsRelationTo(callee2, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee2.getUniqueName(), 1, nrContainsInvocation);
  }
View Full Code Here

    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee2.getUniqueName(), 1, nrContainsInvocation);
  }
 
  @Test
  public void testStaticUndefParamCall() {
    FamixMethod caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls.callStaticUndefParam()", null));
    FamixMethod callee = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.Dummy.staticFoo(<undef>.NotDef)", null));
   
    assertNotNull("Callee method testPackage.UnresolvedCalls.callStaticUndefParam() must exist", caller);
    assertNotNull("Callee method testPackage.Dummy.staticFoo(<undef>.NotDef) must exist", callee);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(caller);
    int nrContainsInvocation = TestHelper.containsRelationTo(callee, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
View Full Code Here

    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + callee.getUniqueName(), 1, nrContainsInvocation);
  }
 
  @Test
  public void testUndefClassInstanceCreation() {
    FamixMethod caller = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.UnresolvedCalls.undefClassInstanceCreation()", null));
    FamixMethod calleeClassKnown  = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.Dummy.<init>()", null));
    FamixMethod calleeClassKnownParamUnkown = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.Dummy.<init>(<undef>.NotDef)", null));
    FamixMethod calleeClassUnknown = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.<init>()", null));
    FamixMethod calleeClassUnknownParamUnkown = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.<init>(<undef>.NotDef)", null));
   
    assertNotNull("Caller method testPackage.UnresolvedCalls.undefClassInstanceCreation() must exist", caller);
    assertNotNull("Callee method testPackage.Dummy.<init>() must exist", calleeClassKnown);
    assertNotNull("Callee method testPackage.Dummy.<init>(<undef>.NotDef) must exist", calleeClassKnownParamUnkown);
    assertNotNull("Callee method <undef>.NotDef.<init>() must exist", calleeClassUnknown);
    assertNotNull("Callee method <undef>.NotDef.<init>(<undef>.NotDef) must exist", calleeClassUnknownParamUnkown);
   
    Set<FamixAssociation> lRelations = fModel.getAssociations(caller);
    int nrContainsInvocation = TestHelper.containsRelationTo(calleeClassKnown, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + calleeClassKnown.getUniqueName(), 1, nrContainsInvocation);
   
    nrContainsInvocation = TestHelper.containsRelationTo(calleeClassKnownParamUnkown, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + calleeClassKnownParamUnkown.getUniqueName(), 1, nrContainsInvocation);
   
    nrContainsInvocation = TestHelper.containsRelationTo(calleeClassUnknown, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + calleeClassUnknown.getUniqueName(), 1, nrContainsInvocation);

    nrContainsInvocation = TestHelper.containsRelationTo(calleeClassUnknownParamUnkown, lRelations);
    assertEquals("FamixInvocation relationships from " + caller.getUniqueName() + " to " + calleeClassUnknownParamUnkown.getUniqueName(), 1, nrContainsInvocation);
  }
View Full Code Here

  @Test
  public void testUndefClassInstanceCreationParents() {
    FamixClass classDummy = (FamixClass) fModel.getElement(fFactory.createClass("testPackage.Dummy", null));
    FamixClass classNotDef = (FamixClass) fModel.getElement(fFactory.createClass("<undef>.NotDef", null));
   
    FamixMethod calleeClassKnownParamUnkown = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.Dummy.<init>(<undef>.NotDef)", null));
    FamixMethod calleeClassUnknown = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.<init>()", null));
    FamixMethod calleeClassUnknownParamUnkown = (FamixMethod) fModel.getElement(fFactory.createMethod("<undef>.NotDef.<init>(<undef>.NotDef)", null));
   
    assertNotNull("FamixClass testPackage.Dummy must exist", classDummy);
    assertNotNull("FamixClass <undef>.NotDef must exist", classNotDef);
    assertNotNull("Callee method testPackage.Dummy.<init>(<undef>.NotDef) must exist", calleeClassKnownParamUnkown);
    assertNotNull("Callee method <undef>.NotDef.<init>() must exist", calleeClassUnknown);
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.