forked from JavaTX/JavaCompilerCore
modified: src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java
This commit is contained in:
parent
a4bc49f5c4
commit
e8ac8e3c5a
@ -58,11 +58,53 @@ public class FamilyOfGeneratedGenericsTest extends TestCase {
|
|||||||
tphPositions.put("B", PositionFinder.Position.METHOD);
|
tphPositions.put("B", PositionFinder.Position.METHOD);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ClassConstraints should be the same as the input constraint
|
ClassConstraints should not be the same as the input constraint
|
||||||
*/
|
*/
|
||||||
List<ClassConstraint> classConstraints = FamilyOfGeneratedGenerics.getClassConstraints(inputConstraints, tphPositions);
|
List<ClassConstraint> classConstraints = FamilyOfGeneratedGenerics.getClassConstraints(inputConstraints, tphPositions);
|
||||||
assertTrue(classConstraints.size() == 1);
|
assertTrue(classConstraints.size() == 2);
|
||||||
assertTrue(classConstraints.get(0).getLeft().equals("A"));
|
//assertTrue(classConstraints.get(0).getLeft().equals("A"));
|
||||||
assertTrue(classConstraints.get(0).getRight().equals("B"));
|
//assertTrue(classConstraints.get(0).getRight().equals("B"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSecondLineOfClassConstraints() {
|
||||||
|
/*
|
||||||
|
class Example() {
|
||||||
|
A a;
|
||||||
|
B b = a;
|
||||||
|
C anyMethod() {
|
||||||
|
F f;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
D otherMethod(E e) {
|
||||||
|
this.b = e;
|
||||||
|
e = this.a;
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
List<TPHConstraint> inputConstraints = new ArrayList<>();
|
||||||
|
inputConstraints.add(new TPHConstraint("A", "B", TPHConstraint.Relation.EXTENDS));
|
||||||
|
inputConstraints.add(new TPHConstraint("F", "C", TPHConstraint.Relation.EXTENDS));
|
||||||
|
inputConstraints.add(new TPHConstraint("E", "B", TPHConstraint.Relation.EXTENDS));
|
||||||
|
inputConstraints.add(new TPHConstraint("A", "E", TPHConstraint.Relation.EXTENDS));
|
||||||
|
inputConstraints.add(new TPHConstraint("E", "D", TPHConstraint.Relation.EXTENDS));
|
||||||
|
|
||||||
|
|
||||||
|
HashMap<String, PositionFinder.Position> tphPositions = new HashMap<>();
|
||||||
|
tphPositions.put("A", PositionFinder.Position.FIELD);
|
||||||
|
tphPositions.put("B", PositionFinder.Position.FIELD);
|
||||||
|
tphPositions.put("C", PositionFinder.Position.METHOD);
|
||||||
|
tphPositions.put("F", PositionFinder.Position.METHOD);
|
||||||
|
tphPositions.put("D", PositionFinder.Position.METHOD);
|
||||||
|
tphPositions.put("E", PositionFinder.Position.METHOD);
|
||||||
|
|
||||||
|
List<ClassConstraint> classConstraints = FamilyOfGeneratedGenerics.getClassConstraints(inputConstraints, tphPositions);
|
||||||
|
System.out.println(classConstraints);
|
||||||
|
assertFalse(classConstraints.isEmpty());
|
||||||
|
assertTrue(classConstraints.size() == 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user