Search in sources :

Example 11 with ChangedEntity

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

the class TestClassComparison method testChangeAndAddition1.

@Test
public void testChangeAndAddition1() throws ParseException, IOException {
    final File file1 = new File(FOLDER, "Test1_1_Equal.java");
    final File file2 = new File(FOLDER, "Test11_ChangeAndAddition.java");
    final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("Test1_1_Equal", ""));
    FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
    Assert.assertTrue(changedMethods.isChange());
    Assert.assertFalse(changedMethods.isOnlyMethodChange());
    Map<String, Set<String>> changedMethods2 = changedMethods.getChangedMethods();
    MatcherAssert.assertThat(changedMethods2.values().iterator().next(), Matchers.contains("<init>"));
}
Also used : ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) Set(java.util.Set) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 12 with ChangedEntity

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

the class TestClassComparison method testStaticFieldAdded.

@Test
public void testStaticFieldAdded() throws ParseException, IOException {
    final File file1 = new File(FOLDER, "Test1_1_Equal.java");
    final File file2 = new File(FOLDER, "Test10_StaticFieldAdded.java");
    final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("Test1_1_Equal", ""));
    FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
    Assert.assertTrue(changedMethods.isChange());
}
Also used : ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 13 with ChangedEntity

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

the class TestClazzFinder method testFindInnerClazz.

@Test
public void testFindInnerClazz() {
    String test = "class A{ class B{ } }";
    JavaParser parser = new JavaParser();
    List<Node> parsed = parser.parse(test).getResult().get().getChildNodes();
    TypeDeclaration<?> clazz = ClazzFinder.findClazz(new ChangedEntity("A$B", ""), parsed);
    Assert.assertNotNull(clazz);
}
Also used : JavaParser(com.github.javaparser.JavaParser) Node(com.github.javaparser.ast.Node) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) Test(org.junit.jupiter.api.Test)

Example 14 with ChangedEntity

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

the class DependencyDetectorTestUtil method changedTestClassChangeManager.

public static ChangeManager changedTestClassChangeManager() {
    final Map<ChangedEntity, ClazzChangeData> changes = new TreeMap<>();
    changes.put(new ChangedEntity("defaultpackage.TestMe", ""), new ClazzChangeData("defaultpackage.TestMe", false));
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    return changeManager;
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TreeMap(java.util.TreeMap)

Example 15 with ChangedEntity

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

the class DependencyDetectorTestUtil method addChange.

public static void addChange(final Map<ChangedEntity, ClazzChangeData> changes, final String module, final String clazz, final String method) {
    final ChangedEntity baseChangedClazz = new ChangedEntity(clazz, module);
    final ClazzChangeData methodChanges = new ClazzChangeData(baseChangedClazz);
    methodChanges.addChange(clazz.substring(clazz.lastIndexOf('.') + 1), method);
    changes.put(baseChangedClazz, methodChanges);
}
Also used : ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity)

Aggregations

ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)138 Test (org.junit.jupiter.api.Test)58 File (java.io.File)57 ClazzChangeData (de.dagere.peass.dependency.changesreading.ClazzChangeData)41 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)25 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)21 ChangeManager (de.dagere.peass.dependency.ChangeManager)18 Set (java.util.Set)17 HashSet (java.util.HashSet)16 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)14 HashMap (java.util.HashMap)14 Map (java.util.Map)13 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)11 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)11 VersionIterator (de.dagere.peass.vcs.VersionIterator)10 TreeMap (java.util.TreeMap)9 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)8 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)6 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)6 LinkedList (java.util.LinkedList)6