### Question:
GenericUtils { public static <T> Class<T> ancestorGenericClass(Class<T> clazz) { ParameterizedType genericSuperclass = firstParameterizedType(clazz); Class<T> genericClass = (Class<T>) genericSuperclass.getActualTypeArguments()[0]; return genericClass; }  static Class<T> ancestorGenericClass(Class<T> clazz); static Class<T> parentGenericClass(Class<T> clazz); static ParameterizedType firstParameterizedType(Class<T> clazz); static Class genericClass(Class<T> clazz);  }### Answer:
@Test public void testAncestorGenericClass() { Assertions.assertThrows(RuntimeException.class, () -> GenericUtils.ancestorGenericClass(AAA.class)); Assertions.assertSame(LinkedList.class, GenericUtils.ancestorGenericClass(BBB.class)); Assertions.assertSame(LinkedList.class, GenericUtils.ancestorGenericClass(CCC.class)); Assertions.assertSame(LinkedList.class, GenericUtils.ancestorGenericClass(DDD.class)); }