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>"));
}
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());
}
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);
}
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;
}
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);
}
Aggregations