use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class DependencyDetectorTestUtil method defaultChangeManager.
public static ChangeManager defaultChangeManager() {
final Map<ChangedEntity, ClazzChangeData> changes = DependencyDetectorTestUtil.buildChanges("", "defaultpackage.NormalDependency", "executeThing");
final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
return changeManager;
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class SuperclassDetectorIT method testSuperclassChange.
@Test
public void testSuperclassChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
final File secondVersion = new File(VERSIONS_FOLDER, "superclass_changed");
final Map<ChangedEntity, ClazzChangeData> changes = new TreeMap<>();
changes.put(new ChangedEntity("defaultpackage.NormalSuperclass", ""), new ClazzChangeData("defaultpackage.NormalSuperclass", false));
final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(secondVersion));
final DependencyReader reader = new DependencyReader(DependencyTestConstants.DEFAULT_CONFIG_NO_VIEWS, new PeassFolders(DependencyTestConstants.CURRENT), DependencyTestConstants.NULL_RESULTS_FOLDERS, null, fakeIterator, changeManager, new ExecutionConfig(5), new KiekerConfig(true), new EnvironmentVariables());
reader.readInitialVersion();
checkInitialDependencies(reader);
fakeIterator.goToNextCommit();
reader.analyseVersion(changeManager);
checkFirstVersionDependencies(reader);
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class TestClassComparison method test6.
@Test
public void test6() throws ParseException, IOException {
final File file1 = new File(FOLDER, "Test1_1_Equal.java");
final File file2 = new File(FOLDER, "Test6_MethodChanged.java");
final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("Test1_1_Equal", ""));
FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
Assert.assertTrue(changedMethods.isChange());
Assert.assertTrue(changedMethods.isOnlyMethodChange());
System.out.println(changedMethods.getChangedMethods());
MatcherAssert.assertThat(changedMethods.getChangedMethods().values().iterator().next(), Matchers.hasItem("doNonStaticThing"));
MatcherAssert.assertThat(changedMethods.getChangedMethods().values().iterator().next(), Matchers.hasItem("<init>"));
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class TestClassComparison method test4.
@Test
public void test4() throws ParseException, IOException {
final File file1 = new File(FOLDER, "Test1_1_Equal.java");
final File file2 = new File(FOLDER, "Test4_2_Formatting.java");
final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("Test1_1_Equal", ""));
FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
Assert.assertFalse(changedMethods.isChange());
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class TestClassComparison method test3.
@Test
public void test3() throws ParseException, IOException {
final File file1 = new File(FOLDER, "Test1_1_Equal.java");
final File file2 = new File(FOLDER, "Test3_2_MethodComments.java");
final ClazzChangeData changedMethods = new ClazzChangeData(new ChangedEntity("Test1_1_Equal", ""));
FileComparisonUtil.getChangedMethods(file1, file2, changedMethods);
Assert.assertFalse(changedMethods.isChange());
}
Aggregations