MethodHierarchyReader { public Map<String, Method> getNameToLeafMethodMap() { readMethodHierarchyIfNecessary(); ImmutableMap.Builder<String, Method> builder = ImmutableMap.builder(); for (List<EndpointMethod> overrides : asMap(endpointMethods).values()) { Method leafMethod = getLeafMethod(overrides).getMethod(); builder.put(leafMethod.getName(), leafMethod); } return builder.build(); } MethodHierarchyReader(Class<?> endpointClass); Iterable<Method> getLeafMethods(); Iterable<EndpointMethod> getLeafEndpointMethods(); Iterable<List<Method>> getMethodOverrides(); Iterable<List<EndpointMethod>> getEndpointOverrides(); Map<String, Method> getNameToLeafMethodMap(); ListMultimap<String, EndpointMethod> getNameToEndpointOverridesMap();  }
@Test public void testGetNameToLeafMethodMap() { Map<String, Method> methods = methodReader.getNameToLeafMethodMap(); TestHelper helper = new TestHelper(methods.size()); for (Map.Entry<String, Method> method : methods.entrySet()) { assertEquals(method.getValue().getName(), method.getKey()); helper.verifySingleMethod(method.getValue()); } helper.verifyAllMethodsSeen(); }
@Test public void testReturnsAreCopies_getNameToLeafMethodMap() { Map<String, Method> methods = methodReader.getNameToLeafMethodMap(); Map<String, Method> methods2 = methodReader.getNameToLeafMethodMap(); assertNotSame(methods, methods2); assertEquals(methods, methods2); }