### Question:
TypeUtil { public static List<Type> invoke(Class<?> target, Type context) { if (target == null) { throw new IllegalArgumentException("target must not be null"); } if (context == null) { throw new IllegalArgumentException("context must not be null"); } if (target.isPrimitive() || target.isArray()) { throw new IllegalArgumentException("target must be a class or interface type"); } if (target == Object.class) { return Collections.emptyList(); } GenericContext generic = toGenericContext(context); if (generic == null) { throw new IllegalArgumentException("context must be a class or interface type"); } if (target.isAssignableFrom(generic.raw) == false) { return null; } if (target.getTypeParameters().length == 0) { return Collections.emptyList(); } if (target.isInterface()) { return invokeInterface(target, generic); } if (generic.raw.isInterface()) { return null; } return invokeClass(target, generic); } private  TypeUtil(); static Class<?> erase(Type type); static List<Type> invoke(Class<?> target, Type context);  }### Answer:
@Test public void object() { List<Type> invoked = TypeUtil.invoke(Object.class, String.class); assertThat(invoked.size(), is(0)); }
@Test public void invokeDeepClass() { List<Type> invoked = TypeUtil.invoke(AbstractCollection.class, StringList.class); assertThat(invoked.size(), is(1)); assertThat(invoked.get(0), is((Type) String.class)); }
@Test public void invokeDeepInterface() { List<Type> invoked = TypeUtil.invoke(Collection.class, StringList.class); assertThat(invoked.size(), is(1)); assertThat(invoked.get(0), is((Type) String.class)); }
@Test public void invokeInterfaceFromInterface() { List<Type> invoked = TypeUtil.invoke(List.class, IStringList.class); assertThat(invoked.size(), is(1)); assertThat(invoked.get(0), is((Type) String.class)); }
@Test public void invokeDeepInterfaceFromInterface() { List<Type> invoked = TypeUtil.invoke(Collection.class, IStringList.class); assertThat(invoked.size(), is(1)); assertThat(invoked.get(0), is((Type) String.class)); }
@Test public void invokeOrthogonal() { List<Type> invoked = TypeUtil.invoke(Set.class, IStringList.class); assertThat(invoked, is(nullValue())); }