@Test public void sortsSubResourceMethodsByUriPatterAndConsumesAndProducesTypes() { ResourceDescriptor resource = new AbstractResourceDescriptor(ResourceForTestSortingOfSubResourceMethods.class); Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> subResourceMethods = resource.getSubResourceMethods(); assertEquals(newArrayList("/b/c/d", "/b/c", "/b/{c}", "/b"), subResourceMethods.keySet().stream().map(UriPattern::getTemplate).collect(toList())); assertEquals(1, subResourceMethods.get(new UriPattern("/b/c/d")).get("GET").size()); assertEquals(1, subResourceMethods.get(new UriPattern("/b/c")).get("GET").size()); assertEquals(1, subResourceMethods.get(new UriPattern("/b/{c}")).get("GET").size()); assertEquals(3, subResourceMethods.get(new UriPattern("/b")).get("GET").size()); List<String> methodNames = subResourceMethods.get(new UriPattern("/b")).get("GET").stream().map(subResourceMethod -> subResourceMethod.getMethod().getName()).collect(toList()); assertEquals(newArrayList("m2", "m5", "m0"), methodNames); }
@Override public Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> getSubResourceMethods() { return subResourceMethods; }
AbstractResourceDescriptor extends BaseObjectModel implements ResourceDescriptor { @Override public Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> getSubResourceMethods() { return subResourceMethods; } }
AbstractResourceDescriptor extends BaseObjectModel implements ResourceDescriptor { @Override public Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> getSubResourceMethods() { return subResourceMethods; } AbstractResourceDescriptor(Class<?> resourceClass);  AbstractResourceDescriptor(String path, Class<?> resourceClass);  AbstractResourceDescriptor(Object resource);  AbstractResourceDescriptor(String path, Object resource); }
AbstractResourceDescriptor extends BaseObjectModel implements ResourceDescriptor { @Override public Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> getSubResourceMethods() { return subResourceMethods; } AbstractResourceDescriptor(Class<?> resourceClass);  AbstractResourceDescriptor(String path, Class<?> resourceClass);  AbstractResourceDescriptor(Object resource);  AbstractResourceDescriptor(String path, Object resource); @Override PathValue getPathValue(); @Override Map<String, List<ResourceMethodDescriptor>> getResourceMethods(); @Override Map<UriPattern, SubResourceLocatorDescriptor> getSubResourceLocators(); @Override Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> getSubResourceMethods(); @Override UriPattern getUriPattern(); @Override boolean isRootResource(); @Override String toString(); }
AbstractResourceDescriptor extends BaseObjectModel implements ResourceDescriptor { @Override public Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> getSubResourceMethods() { return subResourceMethods; } AbstractResourceDescriptor(Class<?> resourceClass);  AbstractResourceDescriptor(String path, Class<?> resourceClass);  AbstractResourceDescriptor(Object resource);  AbstractResourceDescriptor(String path, Object resource); @Override PathValue getPathValue(); @Override Map<String, List<ResourceMethodDescriptor>> getResourceMethods(); @Override Map<UriPattern, SubResourceLocatorDescriptor> getSubResourceLocators(); @Override Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> getSubResourceMethods(); @Override UriPattern getUriPattern(); @Override boolean isRootResource(); @Override String toString();  }