use of de.dagere.peass.dependency.changesreading.ClazzChangeData 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());
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData 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;
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData 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);
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class TestGenerateDependencies method testGenerateDependencies.
@Test
public void testGenerateDependencies() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
DependencyDetectorTestUtil.init(TraceGettingIT.BASIC);
final FakeFileIterator iterator = new FakeFileIterator(TestConstants.CURRENT_FOLDER, Arrays.asList(TraceGettingIT.REPETITION));
ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
final DependencyReader reader = new DependencyReader(DependencyTestConstants.DEFAULT_CONFIG_NO_VIEWS, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, VersionKeeper.INSTANCE, new ExecutionConfig(5), new KiekerConfig(true), new EnvironmentVariables());
final boolean success = reader.readInitialVersion();
Assert.assertTrue(success);
iterator.goToNextCommit();
final ChangeManager manager = Mockito.mock(ChangeManager.class);
final HashMap<ChangedEntity, ClazzChangeData> value = new HashMap<>();
ChangedEntity testMeEntity = new ChangedEntity("viewtest.TestMe", "");
value.put(testMeEntity, new ClazzChangeData(testMeEntity, false));
Mockito.when(manager.getChanges(Mockito.any())).thenReturn(value);
final int tests = reader.analyseVersion(manager);
LOG.debug(Constants.OBJECTMAPPER.writeValueAsString(reader.getDependencies()));
Assert.assertEquals(1, tests);
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class DependencyDetectorIT method testClassRemoval.
@Test
public void testClassRemoval() throws Exception {
final File secondVersion = new File(DependencyTestConstants.VERSIONS_FOLDER, "removed_class");
final Map<ChangedEntity, ClazzChangeData> changes = new TreeMap<>();
final ChangedEntity changedEntity = new ChangedEntity("defaultpackage.TestMe", "");
changes.put(changedEntity, new ClazzChangeData(changedEntity, 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 = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator);
checkClassRemoved(reader);
}
Aggregations