@Test
public void testTypeTakingParametersMustBeSubclassOfParameterizedType() {

    //Reflection on ArrayList<String> gives a ParameterizedType
    class A extends ArrayList<String> { };
    class B extends A { };
    TypeLiteral<List<String>> checker = new TypeLiteral<List<String>>() { };
    Type t = checker.getDefinedType(B.class);
    assertThat("java.lang.String").isEqualTo(t.getTypeName());
}