### Question:
MethodInjectingProvider extends MemberInjectingProvider<T> { static Map<String, List<Method>> collectMethods(Class<?> type, Map<String, List<Method>> seenMethods) { if (type == Object.class) { return seenMethods; } collectMethods(type.getSuperclass(), seenMethods); for (Method method : type.getDeclaredMethods()) { if(Modifier.isStatic(method.getModifiers()) || Modifier.isAbstract(method.getModifiers())) { continue; } String methodSignature = getMethodSignature(method); List<Method> parentMethods = seenMethods.computeIfAbsent(methodSignature, sig -> new ArrayList<>()); parentMethods.removeIf(parentMethod -> isMethodOverride(parentMethod, method)); parentMethods.add(method); } return seenMethods; } MethodInjectingProvider(Provider<T> delegate, DefaultInjector injector); @Override String getName();  }### Answer:
@Test public void collectMethods() { Map<String, List<Method>> methods = MethodInjectingProvider .collectMethods(Class2.class, new LinkedHashMap<>()); assertEquals(3, methods.size()); String[] methodSig = {"int methodInt()", "void methodArgs(int,java.lang.Object,)", "void method1()"}; for(String sig : methodSig) { assertTrue("No method " + sig, methods.containsKey(sig)); } List<Method> methodList = methods.get(methodSig[0]); assertEquals(1, methodList.size()); assertEquals(Class2.class, methodList.get(0).getDeclaringClass()); methodList = methods.get(methodSig[1]); assertEquals(2, methodList.size()); assertEquals(Class1.class, methodList.get(0).getDeclaringClass()); assertEquals(Class2.class, methodList.get(1).getDeclaringClass()); methodList = methods.get(methodSig[2]); assertEquals(1, methodList.size()); assertEquals(Class2.class, methodList.get(0).getDeclaringClass()); }