Package org.evolizer.famix.model.entities

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


 
  @Test
  public void testMethodLocalVariableContainsSimple() {
    FamixMethod simpleMethod = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.Test3.gather()",null));
    assertNotNull("FamixModel most contain method testPackage.Test3.gather()", simpleMethod);
    FamixLocalVariable simpleLocal = fFactory.createLocalVariable("testPackage.Test3.gather().a", null);
    simpleLocal.setSourceAnchor(new SourceAnchor("/TestProject/src/testPackage/Test3.java", 203, 204));
    simpleLocal = (FamixLocalVariable) fModel.getElement(simpleLocal);
    assertNotNull("FamixModel must contain local variable testPackage.Test3.gather().a", simpleLocal);
   
    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) fModel.getElement(fFactory.createClass("<undef>.EliteBoss",null));
    assertNotNull("FamixModel must contain class <undef>.EliteBoss", clazz);
    assertEquals("FamixClass must be equal", clazz, simpleLocal.getDeclaredClass());
  }
View Full Code Here


  @Test
  public void testMethodLocalVariableContainsMulti() {
    FamixMethod simpleMethod = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.Test3.gather()",null));
    assertNotNull("FamixModel must contain method testPackage.Test3.gather()", simpleMethod);
   
    FamixLocalVariable multiLocal1 = fFactory.createLocalVariable("testPackage.Test3.gather().gigs1",simpleMethod);
    multiLocal1.setSourceAnchor(new SourceAnchor("/TestProject/src/testPackage/Test3.java", 249, 254));
    multiLocal1 = (FamixLocalVariable) fModel.getElement(multiLocal1);
    FamixLocalVariable multiLocal2 = fFactory.createLocalVariable("testPackage.Test3.gather().gigs2",simpleMethod);
    multiLocal2.setSourceAnchor(new SourceAnchor("/TestProject/src/testPackage/Test3.java", 257, 262));
    multiLocal2 = (FamixLocalVariable) fModel.getElement(multiLocal2);
   
    assertNotNull("FamixModel must contain local variable testPackage.Test3.gather().gigs1", multiLocal1);
    assertNotNull("FamixModel must contain local variable testPackage.Test3.gather().gigs2", multiLocal2);
   
    assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);
   
    FamixClass clazz = (FamixClass)fModel.getElement(fFactory.createClass("<undef>.Gigs",null));
    assertNotNull("FamixModel must contain class <undef>.Gigs", clazz);
   
    boolean containsLocal1 = containsLocalVariable(simpleMethod, multiLocal1);
    assertTrue("FamixMethod must contain local variable multiLocal1", containsLocal1);
    assertEquals("No or wrong parent method for local variable multiLocal1", simpleMethod, multiLocal1.getParent());
    assertEquals("FamixClass must be equal", clazz, multiLocal1.getDeclaredClass());

    boolean containsLocal2 = containsLocalVariable(simpleMethod, multiLocal2);
    assertTrue("FamixMethod must contain local variable multiLocal2", containsLocal2);
    assertEquals("No or wrong parent method for local variable multiLocal2", simpleMethod, multiLocal2.getParent());
    assertEquals("FamixClass must be equla", clazz, multiLocal2.getDeclaredClass());
  }
View Full Code Here

  @Test
  public void testMethodLocalVariableContainsWithinFor() {
    FamixMethod simpleMethod = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.Test4.iterate()",null));
    assertNotNull("FamixModel must contain method testPackage.Test4.iterate()", simpleMethod);
   
    FamixLocalVariable withinFor = fFactory.createLocalVariable("testPackage.Test4.iterate().iter",simpleMethod);
    withinFor.setSourceAnchor(new SourceAnchor("/TestProject/src/testPackage/Test4.java", 152, 173));
    withinFor = (FamixLocalVariable) fModel.getElement(withinFor);
    assertNotNull("FamixModel must contain local variable testPackage.Test4.iterate().iter", withinFor);
   
    assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);

    boolean containsLocal = containsLocalVariable(simpleMethod, withinFor);
    assertTrue("FamixMethod must contain local variable nrs within for loop", containsLocal);
    assertEquals("No or wrong parent method for local variable nrs within for loop", simpleMethod, withinFor.getParent());
   
    FamixClass clazz = (FamixClass) fModel.getElement(fFactory.createClass("<undef>.Iterator",null));
    assertNotNull("FamixModel must contain class <undef>.Iterator", clazz);
   
    assertEquals("FamixClass must be equal", clazz, withinFor.getDeclaredClass());
   
  }
View Full Code Here

 
  @Test
  public void testArrayLocalVariable(){
    FamixMethod simpleMethod = (FamixMethod) fModel.getElement(fFactory.createMethod("testPackage.Test3.gather()",null));
    assertNotNull("FamixModel must contain method testPackage.Test3.gather()", simpleMethod);
    FamixLocalVariable lVar = fFactory.createLocalVariable("testPackage.Test3.gather().items", simpleMethod);
    lVar.setSourceAnchor(new SourceAnchor("/TestProject/src/testPackage/Test3.java", 216, 235));
    lVar = (FamixLocalVariable)fModel.getElement(lVar);
    assertNotNull("FamixModel must contain local variable testPackage.Test3.gather().items", lVar);
    FamixClass declClass = (FamixClass) fModel.getElement(fFactory.createClass(AbstractFamixEntity.ARRAY_TYPE_NAME, null));
    assertNotNull("FamixModel must contain class " + AbstractFamixEntity.ARRAY_TYPE_NAME, declClass);
   
    assertEquals("FamixClass must be equal", declClass, lVar.getDeclaredClass());
  }
View Full Code Here

    }

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

        assertNotNull("FamixModel must contain local variable testPackage.Variables.m(int,int[]).local", simpleLocal);
        assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);
        boolean containsLocal = TestHelper.containsLocalVariable(simpleMethod, simpleLocal);
        assertTrue("FamixMethod must contain local variable simpleLocal", containsLocal);
        assertEquals("No or wrong parent method for local variable simpleLocal", simpleMethod, simpleLocal.getParent());
    }
View Full Code Here

    }

    @Test
    public void testMethodLocalVariableContainsMulti() {
        FamixMethod simpleMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Variables.m(int,int[])", null));
        FamixLocalVariable multiLocal1 = aFactory.createLocalVariable("testPackage.Variables.m(int,int[]).multi1", null);
        multiLocal1.setSourceAnchor(new SourceAnchor("/TestProject1/src/testPackage/Variables.java", 0, 450));
        multiLocal1 = (FamixLocalVariable) aModel.getElement(multiLocal1);
        FamixLocalVariable multiLocal2 = aFactory.createLocalVariable("testPackage.Variables.m(int,int[]).multi2", null);
        multiLocal2.setSourceAnchor(new SourceAnchor("/TestProject1/src/testPackage/Variables.java", 0, 458));
        multiLocal2 = (FamixLocalVariable) aModel.getElement(multiLocal2);

        assertNotNull("FamixModel must contain local variable testPackage.Variables.m(int,int[]).multi1", multiLocal1);
        assertNotNull("FamixModel must contain local variable testPackage.Variables.m(int,int[]).multi2", multiLocal2);
        assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);

        boolean containsLocal1 = TestHelper.containsLocalVariable(simpleMethod, multiLocal1);
        assertTrue("FamixMethod must contain local variable multiLocal1", containsLocal1);
        assertEquals("No or wrong parent method for local variable multiLocal1", simpleMethod, multiLocal1.getParent());

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

    }

    @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

    }

    @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

 
  @Test
  public void testMethodLocalVariableContainsSimple() {
    FamixMethod simpleMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Test3.gather()",null));
    assertNotNull(simpleMethod);
    FamixLocalVariable simpleLocalVariableWithoutAnchor = aFactory.createLocalVariable("testPackage.Test3.gather().a",simpleMethod);
    simpleLocalVariableWithoutAnchor.setSourceAnchor(new SourceAnchor("/TestProject/src/testPackage/Test3.java",new Integer(203),new Integer(204)));
    FamixLocalVariable simpleLocal = (FamixLocalVariable) aModel.getElement(simpleLocalVariableWithoutAnchor);
    assertNotNull(simpleLocal);
   
    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

  @Test
  public void testMethodLocalVariableContainsMulti() {
    FamixMethod simpleMethod = (FamixMethod) aModel.getElement(aFactory.createMethod("testPackage.Test3.gather()",null));
    assertNotNull(simpleMethod);
   
    FamixLocalVariable multiLocal1WithoutAnchor = aFactory.createLocalVariable("testPackage.Test3.gather().gigs1",simpleMethod);
    multiLocal1WithoutAnchor.setSourceAnchor(new SourceAnchor("/TestProject/src/testPackage/Test3.java",249,254));
    FamixLocalVariable multiLocal1 = (FamixLocalVariable) aModel.getElement(multiLocal1WithoutAnchor);
    FamixLocalVariable multiLocal2WithoutAnchor = aFactory.createLocalVariable("testPackage.Test3.gather().gigs2",simpleMethod);
    multiLocal2WithoutAnchor.setSourceAnchor(new SourceAnchor("/TestProject/src/testPackage/Test3.java",257,262));
    FamixLocalVariable multiLocal2 = (FamixLocalVariable) aModel.getElement(multiLocal2WithoutAnchor);
   
    assertNotNull(multiLocal1);
    assertNotNull(multiLocal2);
   
    assertTrue("FamixMethod must contain local variable", simpleMethod.getLocalVariables().size() > 0);
   
    FamixClass clazz = (FamixClass)aModel.getElement(aFactory.createClass("<undef>.Gigs",null));
    assertNotNull(clazz);
   
    boolean containsLocal1 = containsLocalVariable(simpleMethod, multiLocal1);
    assertTrue("FamixMethod must contain local variable multiLocal1", containsLocal1);
    assertEquals("No or wrong parent method for local variable multiLocal1", simpleMethod, multiLocal1.getParent());
    assertEquals(clazz, multiLocal1.getDeclaredClass());

    boolean containsLocal2 = containsLocalVariable(simpleMethod, multiLocal2);
    assertTrue("FamixMethod must contain local variable multiLocal2", containsLocal2);
    assertEquals("No or wrong parent method for local variable multiLocal2", simpleMethod, multiLocal2.getParent());
    assertEquals(clazz, multiLocal2.getDeclaredClass());
  }
View Full Code Here

TOP

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

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.