### Question:
ReflectionUtil { public static Set<Class<?>> getInterfaces(Class<?> clazz) { if (clazz.isInterface()) { return Collections.singleton(clazz); } Set<Class<?>> interfaces = new LinkedHashSet<>(); while (clazz != null) { Class<?>[] ifcs = clazz.getInterfaces(); for (Class<?> ifc : ifcs) { interfaces.addAll(getInterfaces(ifc)); } clazz = clazz.getSuperclass(); } return interfaces; }  static Class<?> getClassByName(String className); static Object getFieldValue(Object target, String fieldName); static Object invokeMethod(Object target, String methodName); static Object invokeMethod(Object target, String methodName, Class<?>[] parameterTypes, Object[] args); static Object invokeStaticMethod(Class<?> targetClass, String methodName, Class<?>[] parameterTypes,
                                            Object[] parameterValues); static Method getMethod(Class<?> classType, String methodName, Class<?>[] parameterTypes); static Set<Class<?>> getInterfaces(Class<?> clazz); static void modifyStaticFinalField(Class cla, String modifyFieldName, Object newValue); static final int MAX_NEST_DEPTH; }### Answer:
@Test public void testGetInterfaces() { Assertions.assertArrayEquals(new Object[]{Serializable.class}, ReflectionUtil.getInterfaces(Serializable.class).toArray()); Assertions.assertArrayEquals(new Object[]{ Serializable.class, Comparable.class, CharSequence.class}, ReflectionUtil.getInterfaces(String.class).toArray()); }