8fb7a23279
modified: src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java modified: src/test/java/insertGenerics/TestExample42.java modified: src/test/java/insertGenerics/TestExample42_allInOneMethod.java
63 lines
3.3 KiB
Java
63 lines
3.3 KiB
Java
package insertGenerics;
|
|
|
|
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
|
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
|
import de.dhbwstuttgart.bytecode.insertGenerics.*;
|
|
import org.junit.Test;
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
|
|
public class TestExample42 {
|
|
public List<TPHConstraint> fillConstraintsList() {
|
|
List<TPHConstraint> cs = new ArrayList<>();
|
|
cs.add(new TPHConstraint("M", "N", Relation.EXTENDS));
|
|
cs.add(new TPHConstraint("N", "Z", Relation.EXTENDS));
|
|
cs.add(new TPHConstraint("Q", "K", Relation.EXTENDS));
|
|
cs.add(new TPHConstraint("K", "P", Relation.EXTENDS));
|
|
cs.add(new TPHConstraint("W", "M", Relation.EXTENDS));
|
|
cs.add(new TPHConstraint("Z", "V", Relation.EXTENDS));
|
|
return cs;
|
|
}
|
|
|
|
public HashMap<String, PairTphMethod<PositionFinder.Position, String>> fillPosOfTphs() {
|
|
HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs = new HashMap<>();
|
|
|
|
// TPHs "U" und "L" auskommentiert, da nach Vorgaben L zu Z umbenannt und U als void interpretiert wird
|
|
PairTphMethod<PositionFinder.Position, String> posOfK = new PairTphMethod<>(PositionFinder.Position.FIELD, null);
|
|
// PairTphMethod<PositionFinder.Position, String> posOfL = new PairTphMethod<>(PositionFinder.Position.METHOD, "id");
|
|
PairTphMethod<PositionFinder.Position, String> posOfM = new PairTphMethod<>(PositionFinder.Position.METHOD, "id");
|
|
PairTphMethod<PositionFinder.Position, String> posOfN = new PairTphMethod<>(PositionFinder.Position.METHOD, "id");
|
|
PairTphMethod<PositionFinder.Position, String> posOfP = new PairTphMethod<>(PositionFinder.Position.METHOD, "setA");
|
|
PairTphMethod<PositionFinder.Position, String> posOfQ = new PairTphMethod<>(PositionFinder.Position.METHOD, "setA");
|
|
// PairTphMethod<PositionFinder.Position, String> posOfU = new PairTphMethod<>(PositionFinder.Position.METHOD, "m");
|
|
PairTphMethod<PositionFinder.Position, String> posOfV = new PairTphMethod<>(PositionFinder.Position.METHOD, "m");
|
|
PairTphMethod<PositionFinder.Position, String> posOfW = new PairTphMethod<>(PositionFinder.Position.METHOD, "m");
|
|
PairTphMethod<PositionFinder.Position, String> posOfZ = new PairTphMethod<>(PositionFinder.Position.METHOD, "m");
|
|
|
|
posOfTphs.put("K", posOfK);
|
|
// posOfTphs.put("L", posOfL);
|
|
posOfTphs.put("M", posOfM);
|
|
posOfTphs.put("N", posOfN);
|
|
posOfTphs.put("P", posOfP);
|
|
posOfTphs.put("Q", posOfQ);
|
|
// posOfTphs.put("U", posOfU);
|
|
posOfTphs.put("V", posOfV);
|
|
posOfTphs.put("W", posOfW);
|
|
posOfTphs.put("Z", posOfZ);
|
|
return posOfTphs;
|
|
}
|
|
|
|
@Test
|
|
public void genericTest() {
|
|
// List<ClassConstraint> classConstraints = FamilyOfGeneratedGenerics.getClassConstraints(fillConstraintsList(),fillPosOfTphs());
|
|
// System.out.println("ClassConstraints: " + classConstraints);
|
|
// List<MethodConstraint> methodConstraints = FamilyOfGeneratedGenerics.getMethodConstraints(fillConstraintsList(),classConstraints,fillPosOfTphs());
|
|
// System.out.println("MethodConstraints: " + methodConstraints);
|
|
|
|
List<TPHConstraint> testCons;
|
|
}
|
|
}
|