package unify; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import org.junit.Assert; import org.junit.Test; import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; import de.dhbwstuttgart.typeinference.unify.model.Type; import de.dhbwstuttgart.typeinference.unifynew.TypeFactory; public class FiniteClosureTest { @Test public void testSmaller() { TypeFactory tf = new TypeFactory(); Type integer = tf.getSimpleType("Integer"); Type number = tf.getSimpleType("Number"); FiniteClosureBuilder fcb = new FiniteClosureBuilder(); fcb.add(integer, number); fcb.add(tf.getSimpleType("MyMap", "T"), tf.getSimpleType("HashMap", tf.getSimpleType("Integer"))); fcb.add(tf.getSimpleType("HashMap", "T"), tf.getSimpleType("Collection")); IFiniteClosure fc = fcb.getCollectionExample(); /* * Test Case 1: * * smaller(Set) = { HashSet, Set, LinkedHashSet } */ Type setInt = tf.getSimpleType("Set", integer); Type hashSetInt = tf.getSimpleType("HashSet", integer); Type treeSetInt = tf.getSimpleType("TreeSet", integer); Type linkedHashSetInt = tf.getSimpleType("LinkedHashSet", integer); Set expectedResult = new HashSet<>(Arrays.stream(new Type[] { setInt, hashSetInt, linkedHashSetInt, treeSetInt, }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setInt)); /* * Test Case 2: * * smaller(Set) = * { HashSet, Set, TreeSet, LinkedHashSet, * HashSet, Set, TreeSet, LinkedHashSet } */ Type extInt = tf.getExtendsType(integer); Type hashSetExtInt = tf.getSimpleType("HashSet", extInt); Type treeSetExtInt = tf.getSimpleType("TreeSet", extInt); Type linkedHashSetExtInt = tf.getSimpleType("LinkedHashSet", extInt); Type setExtInt = tf.getSimpleType("Set", extInt); expectedResult = new HashSet<>(Arrays.stream(new Type[] { setInt, hashSetInt, linkedHashSetInt, treeSetInt, hashSetExtInt, treeSetExtInt, linkedHashSetExtInt, setExtInt, }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setExtInt)); /* * Test Case 3: * * smaller(Set) = * { HashSet, Set, TreeSet, LinkedHashSet, * HashSet, Set, TreeSet, LinkedHashSet, * HashSet, Set, TreeSet, LinkedHashSet * HashSet } */ Type hashSetNum = tf.getSimpleType("HashSet", number); Type treeSetNum = tf.getSimpleType("TreeSet", number); Type linkedHashSetNum = tf.getSimpleType("LinkedHashSet", number); Type setNum = tf.getSimpleType("Set", number); Type extNum = tf.getExtendsType(number); Type hashSetExtNum = tf.getSimpleType("HashSet", extNum); Type treeSetExtNum = tf.getSimpleType("TreeSet", extNum); Type linkedHashSetExtNum = tf.getSimpleType("LinkedHashSet", extNum); Type setExtNum = tf.getSimpleType("Set", extNum); expectedResult = new HashSet<>(Arrays.stream(new Type[] { setInt, hashSetInt, linkedHashSetInt, treeSetInt, setNum, hashSetNum, linkedHashSetNum, treeSetNum, setExtInt, hashSetExtInt, linkedHashSetExtInt, treeSetExtInt, setExtNum, hashSetExtNum, linkedHashSetExtNum, treeSetExtNum }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setExtNum)); /* * Test Case 4: * smaller(Set) = * { HashSet, Set, TreeSet, LinkedHashSet } */ Type t = tf.getPlaceholderType("T"); Type setT = tf.getSimpleType("Set", t); Type hashSetT = tf.getSimpleType("HashSet", t); Type treeSetT = tf.getSimpleType("TreeSet", t); Type linkedHashSetT = tf.getSimpleType("LinkedHashSet", t); expectedResult = new HashSet<>(Arrays.stream(new Type[] { setT, hashSetT, treeSetT, linkedHashSetT }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setT)); /* * Test Case 5 * * smaller(Set = * { Set, HashSet, TreeSet, LinkedHashSet, * Set, HashSet, TreeSet, LinkedHashSet, * Set, HashSet, TreeSet, LinkedHashSet } */ Type superNum = tf.getSuperType(number); Type superInt = tf.getSuperType(integer); Type setSupInt = tf.getSimpleType("Set", superInt); Type hashSetSupInt = tf.getSimpleType("HashSet", superInt); Type linkedHashSetSupInt = tf.getSimpleType("LinkedHashSet", superInt); Type treeSetSupInt = tf.getSimpleType("TreeSet", superInt); Type setSupNum = tf.getSimpleType("Set", superNum); Type hashSetSupNum = tf.getSimpleType("HashSet", superNum); Type linkedHashSetSupNum = tf.getSimpleType("LinkedHashSet", superNum); Type treeSetSupNum = tf.getSimpleType("TreeSet", superNum); expectedResult = new HashSet<>(Arrays.stream(new Type[] { setSupInt, hashSetSupInt, linkedHashSetSupInt, treeSetSupInt, setSupNum, hashSetSupNum, linkedHashSetSupNum, treeSetSupNum, setInt, hashSetInt, linkedHashSetInt, treeSetInt, setNum, hashSetNum, linkedHashSetNum, treeSetNum }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setSupInt)); /* * Test Case 6: * TODO probleme wenn Set weil T auch in der Klassendeklaration class Set verwendet wird. * smaller(Set, Set, TreeSet, LinkedHashSet, * HashSet, Set, TreeSet, LinkedHashSet } * */ Type t1 = tf.getPlaceholderType("T1"); Type extT1 = tf.getExtendsType(t1); Type setExtT1 = tf.getSimpleType("Set", extT1); Type hashSetExtT1 = tf.getSimpleType("HashSet", extT1); Type treeSetExtT1 = tf.getSimpleType("TreeSet", extT1); Type linkedHashSetExtT1 = tf.getSimpleType("LinkedHashSet", extT1); Type setT1 = tf.getSimpleType("Set", t1); Type hashSetT1 = tf.getSimpleType("HashSet", t1); Type treeSetT1 = tf.getSimpleType("TreeSet", t1); Type linkedHashSetT1 = tf.getSimpleType("LinkedHashSet", t1); expectedResult = new HashSet<>(Arrays.stream(new Type[] { setT1, hashSetT1, treeSetT1, linkedHashSetT1, setExtT1, hashSetExtT1, treeSetExtT1, linkedHashSetExtT1 }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setExtT1)); /* * Test Case 7: * * smaller(Set) = * { HashSet, Set, TreeSet, LinkedHashSet, * HashSet, Set, TreeSet, LinkedHashSet } */ Type notInFc = tf.getSimpleType("notInFC"); Type setNotInFc = tf.getSimpleType("Set", notInFc); Type hashSetNotInFc = tf.getSimpleType("HashSet", notInFc); Type treeSetNotInFc = tf.getSimpleType("TreeSet", notInFc); Type linkedHashSetNotInFc = tf.getSimpleType("LinkedHashSet", notInFc); Type hashSetExtNotInFc = tf.getSimpleType("HashSet", notInFc); Type treeSetExtNotInFc = tf.getSimpleType("TreeSet", notInFc); Type linkedHashSetExtNotInFc = tf.getSimpleType("LinkedHashSet", notInFc); Type setExtNotInFc = tf.getSimpleType("Set", notInFc); expectedResult = new HashSet<>(Arrays.stream(new Type[] { setNotInFc, hashSetNotInFc, treeSetNotInFc, linkedHashSetNotInFc, setExtNotInFc, hashSetExtNotInFc, treeSetExtNotInFc, linkedHashSetExtNotInFc }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setNotInFc)); /* * Test Case 8: * * smaller(Set) = * { Set, HashSet, LinkedHashSet, TreeSet, * Set, HashSet, LinkedHashSet, TreeSet } */ Type superNotInFc = tf.getSuperType(notInFc); Type setSuperNotInFc = tf.getSimpleType("Set", superNotInFc); Type hashSetSuperNotInFc = tf.getSimpleType("HashSet", superNotInFc); Type treeSetSuperNotInFc = tf.getSimpleType("TreeSet", superNotInFc); Type linkedHashSetSuperNotInFc = tf.getSimpleType("LinkedHashSet", superNotInFc); expectedResult = new HashSet<>(Arrays.stream(new Type[] { setNotInFc, hashSetNotInFc, treeSetNotInFc, linkedHashSetNotInFc, setSuperNotInFc, hashSetSuperNotInFc, treeSetSuperNotInFc, linkedHashSetSuperNotInFc }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(setSuperNotInFc)); /* * Test Case 8: * * smaller(NotInFc) = * { NotInFc, NotInFc, NotInFc, NotInFc } */ Type notInFcExtNumber = tf.getSimpleType("NotInFc", extNum); Type notInFcInteger = tf.getSimpleType("NotInFc", integer); Type notInFcNumber = tf.getSimpleType("NotInFc", number); Type notInFcExtInt = tf.getSimpleType("NotInFc", extInt); expectedResult = new HashSet<>(Arrays.stream(new Type[] { notInFcExtNumber, notInFcInteger, notInFcNumber, notInFcExtInt }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, fc.smaller(notInFcExtNumber)); /* * Test Case 9: * * smaller(NotInFc = * { NotInFc, NotInFc } */ Type alsoNotInFc = tf.getSimpleType("AlsoNotInFc"); Type notInFcAlsoNotInFc = tf.getSimpleType("NotInFc", alsoNotInFc); Type notInFcSupAlsoNotInFc = tf.getSimpleType("NotInFc", tf.getSuperType(alsoNotInFc)); expectedResult = new HashSet<>(Arrays.stream(new Type[] { notInFcAlsoNotInFc, notInFcSupAlsoNotInFc }).collect(Collectors.toSet())); Set actual = fc.smaller(notInFcSupAlsoNotInFc); Assert.assertEquals(expectedResult, actual); /* * Test Case 10: * * smaller(TreeMap) = * { TreeMap, TreeMap, TreeMap, TreeMap * TreeMap, TreeMap, TreeMap, TreeMap, * TreeMap, TreeMap, TreeMap * TreeMap, TreeMap, TreeMap, TreeMap } */ Type treeMapExtNumSupInt = tf.getSimpleType("TreeMap", extNum, superInt); expectedResult = new HashSet<>(Arrays.stream(new Type[] { treeMapExtNumSupInt, tf.getSimpleType("TreeMap", extNum, superNum), tf.getSimpleType("TreeMap", extNum, integer), tf.getSimpleType("TreeMap", extNum, number), tf.getSimpleType("TreeMap", number, superInt), tf.getSimpleType("TreeMap", number, superNum), tf.getSimpleType("TreeMap", number, integer), tf.getSimpleType("TreeMap", number, number), tf.getSimpleType("TreeMap", integer, superInt), tf.getSimpleType("TreeMap", integer, superNum), tf.getSimpleType("TreeMap", integer, integer), tf.getSimpleType("TreeMap", integer, number), tf.getSimpleType("TreeMap", extInt, superInt), tf.getSimpleType("TreeMap", extInt, superNum), tf.getSimpleType("TreeMap", extInt, integer), tf.getSimpleType("TreeMap", extInt, number) }).collect(Collectors.toSet())); actual = fc.smaller(treeMapExtNumSupInt); Assert.assertEquals(expectedResult, actual); /* * Test Case 11: * * smaller(SortedMap) = { SortedMap, NavigableMap, TreeMap } */ Type sortedMapNumberT = tf.getSimpleType("SortedMap", number, t); Type navigableMapNumberT = tf.getSimpleType("NavigableMap", number, t); Type treeMapNumberT = tf.getSimpleType("TreeMap", number, t); expectedResult = new HashSet<>(Arrays.stream(new Type[] { sortedMapNumberT, navigableMapNumberT, treeMapNumberT }).collect(Collectors.toSet())); actual = fc.smaller(sortedMapNumberT); Assert.assertEquals(expectedResult, actual); /* * Test Case 12: * * MyMap <* TreeMap> * * smaller(TreeMap) = { TreeMap>, MyMap } */ fcb = new FiniteClosureBuilder(); Type k = tf.getPlaceholderType("K"); Type myMap = tf.getSimpleType("MyMap", k); fcb.add(myMap, tf.getSimpleType("TreeMap", k, tf.getSimpleType("List", k))); fcb.add(integer, number); fc = fcb.getCollectionExample(); Type treeMapNumberListNumber = tf.getSimpleType("TreeMap", number, tf.getSimpleType("List", number)); expectedResult = new HashSet<>(Arrays.stream(new Type[] { treeMapNumberListNumber, tf.getSimpleType("MyMap", number) }).collect(Collectors.toSet())); actual = fc.smaller(treeMapNumberListNumber); Assert.assertEquals(expectedResult, actual); /* * Test Case 13: * * MyMap <* TreeMap> * * smaller(TreeMap) = * { TreeMap, List>, * TreeMap>, * TreeMap>, * TreeMap>, * MyMap } */ Type listInteger = tf.getSimpleType("List", integer); Type treeMapExtNumberListInteger = tf.getSimpleType("TreeMap", extNum, listInteger); expectedResult = new HashSet<>(Arrays.stream(new Type[] { treeMapExtNumberListInteger, tf.getSimpleType("TreeMap", extInt, listInteger), tf.getSimpleType("TreeMap", number, listInteger), tf.getSimpleType("TreeMap", integer, listInteger), tf.getSimpleType("MyMap", integer) }).collect(Collectors.toSet())); actual = fc.smaller(treeMapExtNumberListInteger); Assert.assertEquals(expectedResult, actual); /* * Test Case 14 * * MyMap <* TreeMap> * * smaller(TreeMap) = * { TreeMap, List>, * TreeMap>, * TreeMap>, * TreeMap>, * MyMap * MyMap * MyMap * MyMap */ Type listExtNum = tf.getSimpleType("List", extNum); Type treeMapExtNumListExtNum = tf.getSimpleType("TreeMap", extNum, listExtNum); Type myMapInt = tf.getSimpleType("MyMap", integer); Type myMapNumber = tf.getSimpleType("MyMap", number); Type myMapExtInt = tf.getSimpleType("MyMap", extInt); Type myMapExtNum = tf.getSimpleType("MyMap", extNum); actual = fc.smaller(treeMapExtNumListExtNum); expectedResult = new HashSet<>(Arrays.stream(new Type[] { tf.getSimpleType("TreeMap", extNum, listExtNum), tf.getSimpleType("TreeMap", extInt, listExtNum), tf.getSimpleType("TreeMap", number, listExtNum), tf.getSimpleType("TreeMap", integer, listExtNum), myMapInt, myMapNumber, myMapExtInt, myMapExtNum }).collect(Collectors.toSet())); Assert.assertEquals(expectedResult, actual); /* * Test Case 15: * * MyMap <* TreeMap> * * smaller(NavigableSet>) = * { Permutationen der List, * Permutationen der List in TreeSets, * MyMap und MyMap * } */ Type navSet = tf.getSimpleType("NavigableMap", extInt, tf.getExtendsType(tf.getSimpleType("List", extInt))); actual = fc.smaller(navSet); Assert.assertEquals(82, actual.size()); Assert.assertTrue(actual.contains(myMapExtInt)); Assert.assertTrue(actual.contains(myMapInt)); } @Test public void testGreater() { TypeFactory tf = new TypeFactory(); FiniteClosureBuilder fcb = new FiniteClosureBuilder(); Type k = tf.getPlaceholderType("K"); Type integer = tf.getSimpleType("Integer"); Type number = tf.getSimpleType("Number"); Type myMap = tf.getSimpleType("MyMap", k); Type myIntMap = tf.getSimpleType("MyIntMap"); Type collection = tf.getSimpleType("Collection"); Type sortedSet =tf.getSimpleType("SortedSet", "T"); Type extInt = tf.getExtendsType(integer); Type extNum = tf.getExtendsType(number); Type supInt = tf.getSuperType(integer); Type supNum = tf.getSuperType(number); fcb.add(myMap, tf.getSimpleType("Map", k, tf.getSimpleType("List", k))); fcb.add(myIntMap, tf.getSimpleType("MyMap", integer)); fcb.add(sortedSet, tf.getSimpleType("Set", "T")); // sortedSet < Set missing in collection example fcb.add(integer, number); IFiniteClosure fc = fcb.getCollectionExample(); /* * Test Case 1: * * greater(SortedSet) = * { SortedSet, Set, Collection * SortedSet, SortedSet, SortedSet, * Set, Set, Set } */ Type sortedSetInteger = tf.getSimpleType("SortedSet", integer); Set expectedResult = new HashSet<>(Arrays.stream(new Type[] { sortedSetInteger, tf.getSimpleType("Set", integer), collection, tf.getSimpleType("SortedSet", extInt), tf.getSimpleType("SortedSet", supInt), tf.getSimpleType("SortedSet", extNum), tf.getSimpleType("Set", extInt), tf.getSimpleType("Set", supInt), tf.getSimpleType("Set", extNum) }).collect(Collectors.toSet())); Set actual = fc.greater(sortedSetInteger); Assert.assertEquals(expectedResult, actual); /* * Test Case 2: * * greater(SortedSet) = * { SortedSet, SortedSet, * Set, Set, Collection } */ Type sortedSetExtInt = tf.getSimpleType("SortedSet", extInt); expectedResult = new HashSet<>(Arrays.stream(new Type[] { sortedSetExtInt, tf.getSimpleType("SortedSet", extNum), collection, tf.getSimpleType("Set", extInt), tf.getSimpleType("Set", extNum) }).collect(Collectors.toSet())); actual = fc.greater(sortedSetExtInt); Assert.assertEquals(expectedResult, actual); /* * Test Case 3: * * TODO hier extends und super? (siehe test case 4 bei smaller) * greater(SortedSet) = * { SortedSet, SortedSet, SortedSet, * Set, Set, Set, Collection } */ /* * Test Case 4: * * greater(SortedSet) = * { SortedSet, SortedSet * Set, Set, Collection } */ Type sortedSetSupNum = tf.getSimpleType("SortedSet", supNum); expectedResult = new HashSet<>(Arrays.stream(new Type[] { sortedSetSupNum, tf.getSimpleType("SortedSet", supInt), collection, tf.getSimpleType("Set", supNum), tf.getSimpleType("Set", supInt) }).collect(Collectors.toSet())); actual = fc.greater(sortedSetSupNum); Assert.assertEquals(expectedResult, actual); /* * Test Case 5: * * TODO nicht unifizierbar bei T wenn Set deklariert wurde. Können die beiden T's verschieden sein? * greater(SortedSet) = * { SortedSet, Set, Collection } */ Type extT = tf.getExtendsType(tf.getPlaceholderType("T1")); Type sortedSetExtT = tf.getSimpleType("SortedSet", extT); expectedResult = new HashSet<>(Arrays.stream(new Type[] { sortedSetExtT, tf.getSimpleType("Set", extT), collection, }).collect(Collectors.toSet())); actual = fc.greater(sortedSetExtT); Assert.assertEquals(expectedResult, actual); /* * Test Case 6: * * greater(SortedSet) = * { SortedSet, SortedSet, SortedSet, * Set, Set, Set, Collection } */ Type notInFc = tf.getSimpleType("NotInFc"); Type extNotInFc = tf.getExtendsType(notInFc); Type supNotInFc = tf.getSuperType(notInFc); Type sortedSetNotInFc= tf.getSimpleType("SortedSet", notInFc); expectedResult = new HashSet<>(Arrays.stream(new Type[] { sortedSetNotInFc, tf.getSimpleType("SortedSet", extNotInFc), tf.getSimpleType("SortedSet", supNotInFc), tf.getSimpleType("Set", notInFc), tf.getSimpleType("Set", extNotInFc), tf.getSimpleType("Set", supNotInFc), collection }).collect(Collectors.toSet())); actual = fc.greater(sortedSetNotInFc); Assert.assertEquals(expectedResult, actual); /* * Test Case 7: * * greater(SortedSet, Set, Collection } */ Type sortedSetSupNotInFc= tf.getSimpleType("SortedSet", supNotInFc); expectedResult = new HashSet<>(Arrays.stream(new Type[] { sortedSetSupNotInFc, tf.getSimpleType("Set", supNotInFc), collection }).collect(Collectors.toSet())); actual = fc.greater(sortedSetSupNotInFc); Assert.assertEquals(expectedResult, actual); /* * Test Case 8: * * greater(NotInFc) = * { NotInFc, NotInFc, NotInFC, * NotInFc } */ Type notInFcInteger = tf.getSimpleType("NotInFc", integer); expectedResult = new HashSet<>(Arrays.stream(new Type[] { notInFcInteger, tf.getSimpleType("NotInFc", supInt), tf.getSimpleType("NotInFc", extInt), tf.getSimpleType("NotInFc", extNum) }).collect(Collectors.toSet())); actual = fc.greater(notInFcInteger); Assert.assertEquals(expectedResult, actual); /* * Test Case 9: * greater(NotInFc) = * { NotInFc, NotInFc } */ Type notInFcAlsoNotInFc = tf.getSimpleType("NotInFc", tf.getSimpleType("AlsoNotInFc")); expectedResult = new HashSet<>(Arrays.stream(new Type[] { notInFcAlsoNotInFc, tf.getSimpleType("NotInFc", tf.getExtendsType(tf.getSimpleType("AlsoNotInFc"))), tf.getSimpleType("NotInFc", tf.getSuperType(tf.getSimpleType("AlsoNotInFc"))) }).collect(Collectors.toSet())); actual = fc.greater(notInFcAlsoNotInFc); Assert.assertEquals(expectedResult, actual); /* * Test Case 10: * greater(Map) = * { Map, Map, * Map, Map, * Map, Map, * Map, Map } */ Type mapExtIntInt = tf.getSimpleType("Map", extInt, integer); expectedResult = new HashSet<>(Arrays.stream(new Type[] { mapExtIntInt, tf.getSimpleType("Map", extInt, extInt), tf.getSimpleType("Map", extInt, supInt), tf.getSimpleType("Map", extInt, extNum), tf.getSimpleType("Map", extNum, integer), tf.getSimpleType("Map", extNum, extInt), tf.getSimpleType("Map", extNum, supInt), tf.getSimpleType("Map", extNum, extNum) }).collect(Collectors.toSet())); actual = fc.greater(mapExtIntInt); Assert.assertEquals(expectedResult, actual); /* * Test Case 11: * * MyIntMap < MyMap * MyMap < Map> * * greater(MyIntMap) = * { MyMap, MyMap, MyMap, MyMap, * Map, Map, List, * Map, List, Map, MyIntMap } */ Type listInteger = tf.getSimpleType("List", integer); expectedResult = new HashSet<>(Arrays.stream(new Type[] { myIntMap, tf.getSimpleType("MyMap", integer), tf.getSimpleType("MyMap", extInt), tf.getSimpleType("MyMap", extNum), tf.getSimpleType("MyMap", supInt), tf.getSimpleType("Map", integer, listInteger), tf.getSimpleType("Map", extInt, listInteger), tf.getSimpleType("MyMap", extNum, listInteger), tf.getSimpleType("MyMap", supInt, listInteger) }).collect(Collectors.toSet())); actual = fc.greater(myIntMap); //Assert.assertEquals(expectedResult, actual); /* * Test Case 12: * * MyIntMap < MyMap * MyMap < Map> * * TODO * D d = null; * A> a = null; * a = d; ist nicht möglich! * * greater(MyMap) = * { MyMap, MyMap, * Map>, * Map, List> } */ /* * Test Case 13: * * greater(SortedMap, ? super List>) = * */ } @Test public void testGrArg() { IFiniteClosure fc = new FiniteClosureBuilder().getCollectionExample(); TypeFactory tf = new TypeFactory(); System.out.println("\n\n----- GrArg Test -----"); System.out.println("GrArg(List) = " + fc.grArg(tf.getSimpleType("List", "T"))); System.out.println("GrArg(? extends List) = " + fc.grArg(tf.getExtendsType(tf.getSimpleType("List", "T")))); System.out.println("GrArg(? super List) = " + fc.grArg(tf.getSuperType(tf.getSimpleType("List", "T")))); } @Test public void testSmArg() { IFiniteClosure fc = new FiniteClosureBuilder().getCollectionExample(); TypeFactory tf = new TypeFactory(); System.out.println("\n\n----- SmArg Test -----"); System.out.println("SmArg(List) = " + fc.smArg(tf.getSimpleType("List", "T"))); System.out.println("SmArg(? extends List) = " + fc.smArg(tf.getExtendsType(tf.getSimpleType("List", "T")))); System.out.println("SmArg(? super List) = " + fc.smArg(tf.getSuperType(tf.getSimpleType("List", "T")))); } @Test public void testGetGenericType() { // TODO } private void printDiff(Set expected, Set actual) { System.out.println("Diff:"); System.out.println("In expected but not in actual:"); Set expected1 = new HashSet<>(expected); expected1.removeAll(actual); System.out.println(expected1); } }