package tests; import static org.junit.jupiter.api.Assertions.*; import java.util.ArrayList; import java.util.List; import java.util.Map; 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; class CollaborationAliasCollectorTest { @Test void testMerge() { // Change Here! // String key = "getterOverlap"; String key = "setterOverlap"; 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; for (IAliasCollector dac: dacList) { if (cac == null) { cac = new CollaborationAliasCollector(dac); } else { cac.merge(dac); } } 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.getOccurrencePoint().getStatement().getTimeStamp() + ", " + alias.getTimeStamp()); } assertNotNull(cac); for (IAliasCollector dac: dacList) { assertTrue(cac.getAliasList().contains(dac.getAliasList().get(0))); } } }