Search in sources :

Example 1 with TestDependencies

use of de.dagere.peass.dependency.analysis.data.TestDependencies in project peass by DaGeRe.

the class TestTestDependencies method buildTestDependencies.

private TestDependencies buildTestDependencies() {
    TestDependencies dependencies = new TestDependencies();
    HashMap<ChangedEntity, Set<String>> calledClasses = new HashMap<>();
    Set<String> methods = new HashSet<>();
    methods.add("testA");
    calledClasses.put(new ChangedEntity("package.ClazzA", "moduleA"), methods);
    Set<String> methodsB = new HashSet<>();
    methodsB.add("methodB");
    methodsB.add("methodC(int)");
    calledClasses.put(new ChangedEntity("package.ClazzB", "moduleA"), methodsB);
    dependencies.addDependencies(testEntity, calledClasses);
    return dependencies;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestDependencies(de.dagere.peass.dependency.analysis.data.TestDependencies) HashSet(java.util.HashSet)

Example 2 with TestDependencies

use of de.dagere.peass.dependency.analysis.data.TestDependencies in project peass by DaGeRe.

the class TestTestDependencies method testAddingFQNParameter.

@Test
public void testAddingFQNParameter() {
    TestDependencies dependencies = buildTestDependenciesFQN();
    Set<String> calledMethods = dependencies.getDependencyMap().get(testEntity).getCalledMethods().get(new ChangedEntity("package.ClazzB", "moduleA"));
    MatcherAssert.assertThat(calledMethods, IsIterableContaining.hasItem("methodC(java.lang.Integer)"));
    MatcherAssert.assertThat(calledMethods, IsIterableContaining.hasItem("methodB"));
    testNonParameterChange(dependencies);
    testParameterChange(dependencies, "methodC(java.lang.Integer)");
}
Also used : ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestDependencies(de.dagere.peass.dependency.analysis.data.TestDependencies) Test(org.junit.jupiter.api.Test)

Example 3 with TestDependencies

use of de.dagere.peass.dependency.analysis.data.TestDependencies in project peass by DaGeRe.

the class TestTestDependencies method testBasicAdding.

@Test
public void testBasicAdding() {
    TestDependencies dependencies = buildTestDependencies();
    Set<String> calledMethods = dependencies.getDependencyMap().get(testEntity).getCalledMethods().get(new ChangedEntity("package.ClazzB", "moduleA"));
    MatcherAssert.assertThat(calledMethods, IsIterableContaining.hasItem("methodC(int)"));
    MatcherAssert.assertThat(calledMethods, IsIterableContaining.hasItem("methodB"));
    testNonParameterChange(dependencies);
    testParameterChange(dependencies, "methodC(int)");
}
Also used : ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestDependencies(de.dagere.peass.dependency.analysis.data.TestDependencies) Test(org.junit.jupiter.api.Test)

Example 4 with TestDependencies

use of de.dagere.peass.dependency.analysis.data.TestDependencies in project peass by DaGeRe.

the class TestTestDependencies method buildTestDependenciesFQN.

private TestDependencies buildTestDependenciesFQN() {
    TestDependencies dependencies = new TestDependencies();
    HashMap<ChangedEntity, Set<String>> calledClasses = new HashMap<>();
    Set<String> methods = new HashSet<>();
    methods.add("testA");
    calledClasses.put(new ChangedEntity("package.ClazzA", "moduleA"), methods);
    Set<String> methodsB = new HashSet<>();
    methodsB.add("methodB");
    methodsB.add("methodC(java.lang.Integer)");
    calledClasses.put(new ChangedEntity("package.ClazzB", "moduleA"), methodsB);
    dependencies.addDependencies(testEntity, calledClasses);
    return dependencies;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestDependencies(de.dagere.peass.dependency.analysis.data.TestDependencies) HashSet(java.util.HashSet)

Example 5 with TestDependencies

use of de.dagere.peass.dependency.analysis.data.TestDependencies in project peass by DaGeRe.

the class TestTestDependencies method testClassLevelChange.

@Test
public void testClassLevelChange() {
    TestDependencies dependencies = buildTestDependencies();
    HashMap<ChangedEntity, ClazzChangeData> changes = new HashMap<ChangedEntity, ClazzChangeData>();
    ClazzChangeData clazzChangeData = new ClazzChangeData(new ChangedEntity("package.ClazzA", "moduleA"), false);
    clazzChangeData.addChange("ClazzA", "methodB");
    changes.put(new ChangedEntity("package.ClazzA", "moduleA"), clazzChangeData);
    ChangeTestMapping changeTestMap = dependencies.getChangeTestMap(changes);
    Set<ChangedEntity> changedClazzes = changeTestMap.getChanges().keySet();
    MatcherAssert.assertThat(changedClazzes, IsIterableContaining.hasItem(new ChangedEntity("package.ClazzA", "moduleA", "methodB")));
    MatcherAssert.assertThat(changeTestMap.getChanges().get(new ChangedEntity("package.ClazzA", "moduleA", "methodB")), IsIterableContaining.hasItem(testEntity));
    MatcherAssert.assertThat(changeTestMap.getChanges().get(new ChangedEntity("package.ClazzA", "moduleA")), IsIterableContaining.hasItem(testEntity));
}
Also used : ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) HashMap(java.util.HashMap) ChangeTestMapping(de.dagere.peass.dependency.analysis.data.ChangeTestMapping) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestDependencies(de.dagere.peass.dependency.analysis.data.TestDependencies) Test(org.junit.jupiter.api.Test)

Aggregations

ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)5 TestDependencies (de.dagere.peass.dependency.analysis.data.TestDependencies)5 HashMap (java.util.HashMap)3 Test (org.junit.jupiter.api.Test)3 HashSet (java.util.HashSet)2 Set (java.util.Set)2 ChangeTestMapping (de.dagere.peass.dependency.analysis.data.ChangeTestMapping)1 ClazzChangeData (de.dagere.peass.dependency.changesreading.ClazzChangeData)1