### Question:
UtilReflection { public static Collection<Class<?>> getInterfaces(Class<?> object, Class<?> base) { Check.notNull(object); Check.notNull(base); final Collection<Class<?>> interfaces = new ArrayList<>(); Class<?> current = object; while (current != null) { final Deque<Class<?>> currents = new ArrayDeque<>(filterInterfaces(current, base)); final Deque<Class<?>> nexts = new ArrayDeque<>(); while (!currents.isEmpty()) { nexts.clear(); interfaces.addAll(currents); checkInterfaces(base, currents, nexts); currents.clear(); currents.addAll(nexts); nexts.clear(); } current = current.getSuperclass(); } return interfaces; } private  UtilReflection(); static T create(Class<T> type, Class<?>[] paramTypes, Object... params); @SuppressWarnings("unchecked") static T createReduce(Class<T> type, Object... params); static Class<?>[] getParamTypes(Object... arguments); @SuppressWarnings("unchecked") static Constructor<T> getCompatibleConstructor(Class<T> type, Class<?>... paramTypes); @SuppressWarnings("unchecked") static Constructor<T> getCompatibleConstructorParent(Class<T> type, Class<?>[] paramTypes); static T getMethod(Object object, String name, Object... params); static T getField(Object object, String name); static void setAccessible(AccessibleObject object, boolean accessible); static Collection<Class<?>> getInterfaces(Class<?> object, Class<?> base);  }### Answer:
@Test void testGetInterfaces() { assertEquals(0, UtilReflection.getInterfaces(Interface0.class, Interface0.class).size()); assertEquals(0, UtilReflection.getInterfaces(Interface1.class, Interface0.class).size()); assertEquals(Interface2.class, UtilReflection.getInterfaces(Interface3.class, Interface0.class).iterator().next()); final Collection<Class<?>> interfaces = new ArrayList<>(); interfaces.add(Interface1.class); assertEquals(1, UtilReflection.getInterfaces(ObjectTest1.class, Interface0.class).size()); assertTrue(UtilReflection.getInterfaces(ObjectTest1.class, Interface0.class).containsAll(interfaces)); interfaces.add(Interface2.class); interfaces.add(Interface3.class); assertEquals(3, UtilReflection.getInterfaces(ObjectTest2.class, Interface0.class).size()); assertTrue(UtilReflection.getInterfaces(ObjectTest2.class, Interface0.class).containsAll(interfaces)); }