Search in sources :

Example 1 with ClazzChangeData

use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.

the class TestClassComparison method testImport.

@Test
public void testImport() throws ParseException, IOException, URISyntaxException {
    final File file1 = new File(FOLDER, "TestImport_New.java");
    final File file2 = new File(FOLDER, "TestImport_Old.java");
    final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("de.TestImport_new", ""));
    FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
    Assert.assertTrue(changedMethods.isChange());
    MatcherAssert.assertThat(changedMethods.getChanges(), Matchers.hasItem(new ChangedEntity("de.Test", "")));
    MatcherAssert.assertThat(changedMethods.getChanges(), Matchers.hasItem(new ChangedEntity("de.Test$InnerTest", "")));
}
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 2 with ClazzChangeData

use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.

the class TestClassComparison method testChangeAndAddition2.

@Test
public void testChangeAndAddition2() throws ParseException, IOException {
    final File file1 = new File(FOLDER, "Test1_1_Equal.java");
    final File file2 = new File(FOLDER, "Test12_ChangeAndAddition2.java");
    final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("Test1_1_Equal", ""));
    FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
    Assert.assertTrue(changedMethods.isChange());
    Assert.assertFalse(changedMethods.isOnlyMethodChange());
    System.out.println(changedMethods.getChangedMethods());
    MatcherAssert.assertThat(changedMethods.getChangedMethods().values().iterator().next(), Matchers.containsInAnyOrder("<init>", "doNonStaticThing"));
}
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 3 with ClazzChangeData

use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.

the class TestClassComparison method test2.

@Test
public void test2() throws ParseException, IOException {
    final File file1 = new File(FOLDER, "Test1_1_Equal.java");
    final File file2 = new File(FOLDER, "Test2_2_Comments.java");
    final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("Test1_1_Equal", ""));
    FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
    Assert.assertFalse(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 4 with ClazzChangeData

use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.

the class TestClassComparison method test1.

@Test
public void test1() throws ParseException, IOException, URISyntaxException {
    final File file1 = new File(FOLDER, "Test1_1_Equal.java");
    final File file2 = new File(FOLDER, "Test1_2_Equal.java");
    final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("Test1_1_Equal", ""));
    FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
    Assert.assertFalse(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 5 with ClazzChangeData

use of de.dagere.peass.dependency.changesreading.ClazzChangeData 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)

Aggregations

ClazzChangeData (de.dagere.peass.dependency.changesreading.ClazzChangeData)42 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)41 Test (org.junit.jupiter.api.Test)26 File (java.io.File)25 ChangeManager (de.dagere.peass.dependency.ChangeManager)17 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)10 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)10 VersionIterator (de.dagere.peass.vcs.VersionIterator)9 TreeMap (java.util.TreeMap)9 HashMap (java.util.HashMap)7 PeassFolders (de.dagere.peass.folders.PeassFolders)5 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)4 KiekerConfig (de.dagere.peass.config.KiekerConfig)4 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)4 ChangeTestMapping (de.dagere.peass.dependency.analysis.data.ChangeTestMapping)3 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)3 Map (java.util.Map)3 Set (java.util.Set)3 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)2 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)2