package tests; import static org.junit.jupiter.api.Assertions.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.junit.jupiter.api.Test; import org.ntlab.deltaExtractor.Alias; import org.ntlab.deltaExtractor.ExtractedStructure; import org.ntlab.deltaExtractor.IAliasCollector; import org.ntlab.deltaViewer.CollaborationAliasCollector; import org.ntlab.trace.MethodExecution; class CollaborationAliasCollectorTest { @Test void testMerge() { // Change Here! // String key = "getterOverlap"; // String key = "setterOverlap"; String key = "JHotDrawSelect"; MagnetRONFrameTest magnetRONFrame = new MagnetRONFrameTest(); Map<ExtractedStructure, IAliasCollector> extractedMultipleDeltas = magnetRONFrame.extractMultipleDeltas(key); List<ExtractedStructure> eList = new ArrayList<>(extractedMultipleDeltas.keySet()); List<IAliasCollector> dacList = new ArrayList<>(extractedMultipleDeltas.values()); CollaborationAliasCollector cac = null; Map<MethodExecution, Set<MethodExecution>> newToOldMethodExecMap = new HashMap<>(); for (IAliasCollector dac: dacList) { if (cac == null) { cac = new CollaborationAliasCollector(dac); } else { cac.merge(dac, null, newToOldMethodExecMap); } } System.out.println("mergedAliasList: "); for (Alias alias: cac.getAliasList()) { System.out.println(alias.getObjectId() + ", " + alias.getMethodSignature() + " l." + alias.getLineNo() + " : " + alias.getAliasType().toString() + ", (" + alias.getMethodExecution().getEntryTime() + ", " + alias.getMethodExecution().getExitTime() + "), " + alias.getTimeStamp()); } assertNotNull(cac); for (IAliasCollector dac: dacList) { assertTrue(cac.getAliasList().contains(dac.getAliasList().get(0))); } } }