ClassUtil { public static boolean isSubClassOrInterfaceOf(Class subclass, Class superclass) { return superclass.isAssignableFrom(subclass); }  static String getShortClassName(final Class<?> cls); static String getShortClassName(final String className); static String getPackageName(final Class<?> cls); static String getPackageName(final String className); static List<Class<?>> getAllSuperclasses(final Class<?> cls); static List<Class<?>> getAllInterfaces(final Class<?> cls); static boolean isSubClassOrInterfaceOf(Class subclass, Class superclass); static Class<?> unwrapCglib(Object instance); static Class<T> getClassGenericType(final Class clazz); static Class getClassGenericType(final Class clazz, final int index);  }
@Test public void testIsSubClassOrInterfaceOf() { assertTrue("TestBean should be subclass of ParentBean", ClassUtil.isSubClassOrInterfaceOf(BClass.class, AClass.class)); assertTrue("BInterface should be subinterface of AInterface", ClassUtil.isSubClassOrInterfaceOf(BInterface.class, AInterface.class)); assertTrue("BClass should be an implementation of BInterface", ClassUtil.isSubClassOrInterfaceOf(BClass.class, BInterface.class)); assertTrue("BClass should be an implementation of AInterface", ClassUtil.isSubClassOrInterfaceOf(BClass.class, AInterface.class)); }