### Question:
Utils { static Class<?>[] extractAllInterfaces(final Class<?> clazz) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Class<?> currClazz = clazz; currClazz != null; currClazz = currClazz.getSuperclass()) { Collections.addAll(interfaces, currClazz.getInterfaces()); } return interfaces.toArray(new Class[interfaces.size()]); } private  Utils();   }### Answer:
@Test public void testExtractAllInterfaces() { final Class<?>[] intfs = Utils.extractAllInterfaces(HashSet.class); final Set<Class<?>> coll = new HashSet<Class<?>>(); Collections.addAll(coll, intfs); Assert.assertTrue(coll.contains(Collection.class)); Assert.assertTrue(coll.contains(Serializable.class)); }