public void resolve_includeBaseType() throws Exception {
ClassTypeInfo myClassType = factory.getClassType(MyClass.class);
ClassTypeInfo listAType = (ClassTypeInfo) factory.getType(MyClass.class.getField("listA").getGenericType());
// includeBaseType==false, Iterable<T=E> => Iterable<T=A>
TypeInfo expectedType = factory.getParameterizedType(Iterable.class, MyClass.class.getTypeParameters()[0]);
ClassTypeInfo iterableType = (ClassTypeInfo) factory.getType(List.class).getSupertype(Iterable.class);
TypeInfo resolvedIterableType = iterableType.resolve(listAType, false);
assertEquals(expectedType, resolvedIterableType);
// resolvedIterableType应当还能再次resolve:Iterable<T=A> => Iterable<T=Integer>
expectedType = factory.getParameterizedType(Iterable.class, Integer.class);
ParameterizedTypeInfo context = factory.getParameterizedType(MyClass.class, Integer.class);
assertEquals(expectedType, resolvedIterableType.resolve(context));
assertEquals(expectedType, resolvedIterableType.resolve(context, true));
assertEquals(expectedType, resolvedIterableType.resolve(context, false));
// includeBaseType==true, Iterable<T=E> => Iterable<T=Number>
expectedType = factory.getParameterizedType(Iterable.class, Number.class);
assertEquals(expectedType, iterableType.resolve(listAType));
assertEquals(expectedType, iterableType.resolve(listAType, true));
// includeBaseType==false, T => A
TypeInfo varA = myClassType.getTypeParameters().get(0);
TypeInfo varT = iterableType.getTypeParameters().get(0);
assertEquals(varA, varT.resolve(listAType, false));
// includeBaseType==true, T => Number
assertEquals(factory.getType(Number.class), varT.resolve(listAType));
assertEquals(factory.getType(Number.class), varT.resolve(listAType, true));
}