Include { public boolean match(String relativePath) { Matcher m = createMatcher(); for (String e : PathUtils.elements(relativePath)){ m = m.next(e); } return m.isMatch(); } Include(String pattern); boolean match(String relativePath); String getPattern(); @Override String toString(); Matcher createMatcher(); boolean match(String nodeName, int depth); boolean matchAny(int depth); int size();  }
@Test public void simpleWildcard() throws Exception{ Include i = new Include("*"); assertTrue(i.match("x")); assertTrue(i.match("/x")); assertFalse(i.match("/x/y")); }
@Test public void exactName() throws Exception{ assertTrue(new Include("x").match("x")); assertFalse(new Include("x").match("y")); assertTrue(new Include("x/y").match("x")); assertFalse(new Include("x/y").match("y")); assertTrue(new Include("x/y").match("x/y")); }
@Test public void directiveAll() throws Exception{ Include i = new Include("x/**"); assertTrue(i.match("x/y")); assertTrue(i.match("x/y/z")); assertTrue(i.match("x/y/z/x")); Include i2 = new Include("x/y/**"); assertTrue(i2.match("x/y")); assertTrue(i2.match("x/y/z")); assertTrue(i2.match("x/y/z/x")); }