ReflectUtil { public static List<Method> getAllDeclaredMethods(Class<?> clazz) { return getAllDeclaredMethodsInternal(clazz, new HashSet<MethodDesc>()); }  static List<Field> getAllDeclaredFields(Class<?> clazz); static List<Method> getAllDeclaredMethods(Class<?> clazz); static @Nullable Annotation findQualifierAnnotation(Field field); static @Nullable Annotation findQualifierAnnotation(Annotation[] annotations, String description); static boolean isAnyAnnotationPresent(Field field, Collection<Class<? extends Annotation>> annotations); static boolean isAnyAnnotationPresent(Method method, Collection<Class<? extends Annotation>> annotations);  }
@Test public void testGetAllMethodsOnSubclass() { List<Method> methodList = ReflectUtil.getAllDeclaredMethods(SubClass.class); assertThat(methodList).hasSize(14); for (int i = 0; i < 11; i++) { assertTrue(methodList.get(i).getDeclaringClass() == Object.class); } assertThat(methodList.get(12).getName()).isEqualTo("doSomething"); assertThat(methodList.get(13).getName()).isEqualTo("doSomethingElse"); }