Package org.evolizer.famix.model.entities

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


    assertTrue("Missing inheritance relationship in sub class " + clazz.getUniqueName() + " to " + superClass.getUniqueName(), containsInheritsTo > 0);
  }
 
  @Test
  public void testUnresolvedInterfaces(){
    FamixClass interfaceClass = (FamixClass) aModel.getElement(aFactory.createClass("<undef>.SomeInterface",null));
    FamixClass baseClass = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.Test",null));
    assertNotNull(interfaceClass);
    assertNotNull(baseClass);
   
    Set<FamixAssociation> lRelations = aModel.getAssociations(baseClass);
    assertTrue("FamixClass " + baseClass.getUniqueName() + " must contain relationships", lRelations.size() > 0);
    int containsInheritsTo = TestHelper.containsRelationTo(interfaceClass, lRelations);
    assertTrue("Missing inheritance relationship in class" + baseClass.getUniqueName() + " to " + interfaceClass.getUniqueName(), containsInheritsTo > 0);
   
    lRelations = aModel.getAssociations(interfaceClass);
    assertTrue("FamixClass " + interfaceClass.getUniqueName() + " must contain relationships", lRelations.size() > 0);
    containsInheritsTo = TestHelper.containsRelationTo(interfaceClass, lRelations);
    assertTrue("Missing inheritance relationship in sub class " + baseClass.getUniqueName() + " to " + interfaceClass.getUniqueName(), containsInheritsTo > 0);
  }
View Full Code Here


    /**
     * Add links to parent entities (file, package, class)
     */
    public void addParentLink() {
        if (getTypeBinding().isNested()) {
            FamixClass cl = getCurrTypeFromTypeReminder();
            cl.getInnerClasses().add(getCurrType());
            getCurrType().setParent(cl);
        } else {
            addClassToPackage();
        }
    }
View Full Code Here

   
    /**
     * Add a default constructor if no constructor is defined in the class.
     */
    protected void createDefaultConstructor() {
        FamixClass currentType = getCurrType();
       
        //
        if (!existsAConstructor()) {
            StringBuffer defaultConstructorId = new StringBuffer();
            defaultConstructorId.append(currentType.getUniqueName());
            defaultConstructorId.append(AbstractFamixEntity.NAME_DELIMITER);
            defaultConstructorId.append(AbstractFamixEntity.CONSTRUCTOR_PREFIX);
            defaultConstructorId.append(AbstractFamixEntity.METHOD_START_BRACE);
            defaultConstructorId.append(AbstractFamixEntity.METHOD_END_BRACE);
           
            FamixMethod defaultConstructor = getFactory().createMethod(defaultConstructorId.toString(), currentType);
            defaultConstructor = (FamixMethod) getModel().addElement(defaultConstructor);
   
            // if the not explicitly defined default constructor has already been called and is in
            // the model it does not have a parent yet
            if (defaultConstructor.getParent() == null) {
                defaultConstructor.setParent(currentType);
            }
            currentType.getMethods().add(defaultConstructor);
        }
    }
View Full Code Here

    assertTrue("Missing inheritance relationship in sub class " + baseClass.getUniqueName() + " to " + interfaceClass.getUniqueName(), containsInheritsTo > 0);
  }
 
  @Test
  public void testUnresolvedAttribute(){
    FamixClass clazz = (FamixClass)aModel.getElement(aFactory.createClass("<undef>.Warrior",null));
    FamixAttribute simpleAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Test.gigs",null));
    assertNotNull(clazz);
    assertNotNull(simpleAttribute);
    assertEquals(simpleAttribute.getDeclaredClass(), clazz);
   
View Full Code Here

   
    FamixParameter param = (FamixParameter) aModel.getElement(aFactory.createFormalParameter("testPackage.Test.myMethod(int,double,<undef>.Warlock).i",null,0));
    assertNotNull(param);
    assertEquals(new Integer(0), param.getParamIndex());
   
    FamixClass clazz = (FamixClass) aModel.getElement(aFactory.createClass("int",null));
    assertEquals(clazz, param.getDeclaredClass());
    assertTrue(method.getParameters().contains(param));
    assertEquals(method, param.getParent());
   
    param = (FamixParameter) aModel.getElement(aFactory.createFormalParameter("testPackage.Test.myMethod(int,double,<undef>.Warlock).d",null,1));
View Full Code Here

    assertNotNull(method);
   
    FamixParameter param = (FamixParameter) aModel.getElement(aFactory.createFormalParameter("testPackage.Test.myMethod(<undef>.Hunter[]).h",null,0));
    assertNotNull(param);
    assertEquals(new Integer(0), param.getParamIndex());
    FamixClass clazz = (FamixClass)aModel.getElement(aFactory.createClass(AbstractFamixEntity.ARRAY_TYPE_NAME,null));
    assertEquals(clazz, param.getDeclaredClass());
    assertTrue(method.getParameters().contains(param));
    assertEquals(method, param.getParent());
  }
View Full Code Here

    assertEquals(method, param.getParent());
  }
 
  @Test
  public void testUnresolvedReturnParameter(){
    FamixClass clazz = (FamixClass) aModel.getElement(aFactory.createClass("<undef>.Dudu",null));
    assertNotNull(clazz);
    FamixMethod method = (FamixMethod)aModel.getElement(aFactory.createMethod("testPackage.Test.someMethod()",null));
    assertNotNull(method);
    assertEquals(clazz, method.getDeclaredReturnClass());
  }
View Full Code Here

    assertEquals(clazz, method.getDeclaredReturnClass());
  }
 
  @Test
  public void testUnresolvedArrayReturnParameter(){
    FamixClass clazz = (FamixClass)aModel.getElement(aFactory.createClass(AbstractFamixEntity.ARRAY_TYPE_NAME,null));
    assertNotNull(clazz);
    FamixMethod method = (FamixMethod)aModel.getElement(aFactory.createMethod("testPackage.Test.method()",null));
    assertNotNull(method);
    assertEquals(method.getDeclaredReturnClass(), clazz);
  }
View Full Code Here

    assertEquals(method.getDeclaredReturnClass(), clazz);
  }
 
  @Test
  public void testUnresolvedArrayAttribute(){
    FamixClass clazz = (FamixClass)aModel.getElement(aFactory.createClass(AbstractFamixEntity.ARRAY_TYPE_NAME,null));
    assertNotNull(clazz);
    FamixAttribute simpleAttribute = (FamixAttribute) aModel.getElement(aFactory.createAttribute("testPackage.Test2.paladins",null));
    assertNotNull(simpleAttribute);
    assertEquals(clazz, simpleAttribute.getDeclaredClass());
  }
View Full Code Here

    assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);
    boolean containsLocal = containsLocalVariable(simpleMethod, simpleLocal);
    assertTrue("FamixMethod must contain local variable simpleLocal", containsLocal);
    assertEquals("No or wrong parent method for local variable simpleLocal", simpleMethod, simpleLocal.getParent());
   
    FamixClass clazz = (FamixClass) aModel.getElement(aFactory.createClass("<undef>.EliteBoss",null));
    assertNotNull(clazz);
    assertEquals(clazz, simpleLocal.getDeclaredClass());
  }
View Full Code Here

TOP

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

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.