@Test
public void sortsSubResourceLocatorsByUriPatter() {

    ResourceDescriptor resource = new AbstractResourceDescriptor(ResourceForTestSortingOfSubResourceLocators.class);
    Map<UriPattern, SubResourceLocatorDescriptor> resourceLocators = resource.getSubResourceLocators();
    assertEquals(newArrayList("/b/c/d", "/b/c/z", "/b/c", "/b/{c}", "/b"),
                 resourceLocators.keySet().stream().map(UriPattern::getTemplate).collect(toList()));
}