MethodHierarchyReader { public ListMultimap<String, EndpointMethod> getNameToEndpointOverridesMap() { readMethodHierarchyIfNecessary(); ImmutableListMultimap.Builder<String, EndpointMethod> builder = ImmutableListMultimap.builder(); for (List<EndpointMethod> overrides : asMap(endpointMethods).values()) { builder.putAll(getLeafMethod(overrides).getMethod().getName(), overrides); } 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 testGetNameToEndpointOverridesMap() { ListMultimap<String, EndpointMethod> methods = methodReader.getNameToEndpointOverridesMap(); TestHelper helper = new TestHelper(methods.keySet().size()); for (String methodName : methods.keySet()) { List<EndpointMethod> overrides = methods.get(methodName); Method method = overrides.get(0).getMethod(); assertEquals(method.getName(), methodName); helper.verifySingleMethod(method); verifyOverrides(method, overrides); } helper.verifyAllMethodsSeen(); }
@Test public void testReturnsAreCopies_getNameToEndpointOverridesMap() { ListMultimap<String, EndpointMethod> methods = methodReader.getNameToEndpointOverridesMap(); ListMultimap<String, EndpointMethod> methods2 = methodReader.getNameToEndpointOverridesMap(); assertNotSame(methods, methods2); assertEquals(methods, methods2); }