SimplePathPattern implements PathPattern { public List<PathParamName> varNames(){ List<PathParamName> names = new ArrayList<PathParamName>(segs.size()); for(Seg s:segs){ if(s.isVar) names.add(s.name); } return names; } SimplePathPattern(String pattern); List<PathParamName> varNames(); boolean matches(String path); Path match(String path); String raw();  }
@Test public void returnsVariableNames(){ PathPattern p = new SimplePathPattern("/every/{good}/boy/{loves}/figs/{remainder*}"); List<PathParamName> names = p.varNames(); assertEquals(3, names.size()); assertEquals("good", names.get(0).name); assertEquals("loves", names.get(1).name); assertEquals("remainder", names.get(2).name); }