### Question:
ReflectUtil { public static Type[] getActualTypeArguments(Class<?> clazz, Class<?> targetType) { return getActualTypeArguments(clazz, targetType, null); } private  ReflectUtil(); static boolean isDefault(Method method); @SuppressWarnings("rawtypes") // this allows us to assign without casting static Class findClass(String name); static String toString(Annotation ann); static Collection<Method> getMethods(Class<?> clazz); static Collection<Field> getFields(Class<?> clazz); static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, String property); static Method findAccessibleMethod(final Method m); static Field getField(Class<?> clazz, String property); static Object getDefaultValue(Class<?> clazz); static Set<Class<?>> getImplementedInterfaces(Class<?> clazz); static Type[] getActualTypeArguments(Class<?> clazz, Class<?> targetType); static PropertyDescriptor[] getPropertyDescriptors(Class<?> clazz); static Method resolveBridgedReadMethod(PropertyDescriptor pd); static Method resolveBridgedWriteMethod(PropertyDescriptor pd); static Class<?> resolvePropertyType(PropertyDescriptor pd);  }### Answer:
@Test(groups = "fast") public void testResolveTypeArgsOfSuperInterface() { class Impl implements C { } Type[] typeArgs = ReflectUtil.getActualTypeArguments(Impl.class, A.class); Assert.assertEquals(typeArgs.length, 3); Assert.assertEquals(typeArgs[0], Long.class); Assert.assertEquals(typeArgs[1], String.class); Assert.assertEquals(typeArgs[2], Integer.class); }
@Test(groups = "fast") public void testResolveTypeArgsOfSuperclass() { abstract class BaseClass1<S, T, U> { } abstract class BaseClass2<V, W> extends BaseClass1<W, String, V> {} class Impl1<X> extends BaseClass2<Integer, X> { } class Impl2 extends Impl1<Long> { } class Impl3 extends Impl2 { } Type[] typeArgs = ReflectUtil.getActualTypeArguments(Impl3.class, BaseClass1.class); Assert.assertEquals(typeArgs.length, 3); Assert.assertEquals(typeArgs[0], Long.class); Assert.assertEquals(typeArgs[1], String.class); Assert.assertEquals(typeArgs[2], Integer.class); }