RootResourceClassesRule implements UriRule { public boolean accept(CharSequence path, Object resource, UriRuleContext context) { UriRuleProbeProvider.ruleAccept( RootResourceClassesRule.class.getSimpleName(), path, resource ); if (context.isTracingEnabled()) { context.trace("accept root resource classes: \"" + path + "\""); } final Iterator<UriRule> matches = rules.match(path, context); while(matches.hasNext()) if(matches.next().accept(path, resource, context)) return true; return false; } RootResourceClassesRule(final Map<PathPattern, UriRule> rulesMap); boolean accept(CharSequence path, Object resource, UriRuleContext context);  }
@Test public void testExpectsPositiveAcceptance() throws Exception { UriTemplate template = new UriTemplate("/test/{name}/{id}"); Object foo = new ResourceDbl(); Map<PathPattern, UriRule> map = new HashMap<PathPattern, UriRule>(); map.put(new PathPattern(template), new ResourceObjectRule(template, foo)); UriRule rule = new RootResourceClassesRule(map); assertFalse(rule.accept("/test", foo, UriRuleContextDbl.make())); }