diff --git a/src/test/java/br/unc/cic/analysis/test/DefinitionFactory.java b/src/test/java/br/unc/cic/analysis/test/DefinitionFactory.java index 73ee4c98..439972a0 100644 --- a/src/test/java/br/unc/cic/analysis/test/DefinitionFactory.java +++ b/src/test/java/br/unc/cic/analysis/test/DefinitionFactory.java @@ -15,30 +15,22 @@ public static AbstractMergeConflictDefinition definition(String className, int s } public static AbstractMergeConflictDefinition definition(String className, int sourceLines[], int sinkLines[], boolean recursive) { - return new AbstractMergeConflictDefinition(recursive) { - @Override - protected Map> sourceDefinitions() { - Map> res = new HashMap<>(); - List lines = Arrays.stream(sourceLines).boxed().collect(Collectors.toList()); - res.put(className, lines); - return res; - } + return definition(Arrays.asList(new MarkingClass(className, sourceLines, sinkLines)), recursive); + }; - @Override - protected Map> sinkDefinitions() { - Map> res = new HashMap<>(); - List lines = Arrays.stream(sinkLines).boxed().collect(Collectors.toList()); - res.put(className, lines); - return res; - } - }; - } - public static AbstractMergeConflictDefinition definition(List markings) { - return new AbstractMergeConflictDefinition(false) { + /** + * + * @param markingClassList It is a list of tags. Each tag as lines marked as source and as lines marked as sink + * and the name of the class where the lines were marked. + * @param recursive Indicates whether the loading of statements will be done recursively or not. + * @return + */ + public static AbstractMergeConflictDefinition definition(List markingClassList, boolean recursive) { + return new AbstractMergeConflictDefinition(recursive) { @Override protected Map> sourceDefinitions() { Map> res = new HashMap<>(); - for(Marking m: markings){ + for(MarkingClass m: markingClassList){ List lines = Arrays.stream(m.getSourceLines()).boxed().collect(Collectors.toList()); res.put(m.getClassName(), lines); } @@ -48,7 +40,7 @@ protected Map> sourceDefinitions() { @Override protected Map> sinkDefinitions() { Map> res = new HashMap<>(); - for(Marking m: markings) { + for(MarkingClass m: markingClassList) { List lines = Arrays.stream(m.getSinkLines()).boxed().collect(Collectors.toList()); res.put(m.getClassName(), lines); } diff --git a/src/test/java/br/unc/cic/analysis/test/Marking.java b/src/test/java/br/unc/cic/analysis/test/MarkingClass.java similarity index 86% rename from src/test/java/br/unc/cic/analysis/test/Marking.java rename to src/test/java/br/unc/cic/analysis/test/MarkingClass.java index 7ac3d15c..a0997c39 100644 --- a/src/test/java/br/unc/cic/analysis/test/Marking.java +++ b/src/test/java/br/unc/cic/analysis/test/MarkingClass.java @@ -1,11 +1,11 @@ package br.unc.cic.analysis.test; -public class Marking { +public class MarkingClass { String className; int sourceLines[]; int sinkLines[]; - public Marking(String className, int[] sourceLines, int[] sinkLines) { + public MarkingClass(String className, int[] sourceLines, int[] sinkLines) { this.className = className; this.sourceLines = sourceLines; this.sinkLines = sinkLines;