Include { public Matcher createMatcher() { return new IncludeMatcher(this); } 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 depth() throws Exception{ Include i0 = new Include("x/*"); assertEquals(0, i0.createMatcher().depth()); assertEquals(1, i0.createMatcher().next("x").depth()); assertEquals(2, i0.createMatcher().next("x").next("y").depth()); assertEquals(0, i0.createMatcher().next("x").next("y").next("z").depth()); Include i2 = new Include("x/y/**"); assertEquals(0, i2.createMatcher().depth()); assertEquals(1, i2.createMatcher().next("x").depth()); assertEquals(2, i2.createMatcher().next("x").next("y").depth()); assertEquals(3, i2.createMatcher().next("x").next("y").next("z").depth()); }
@Test public void matchChildren() throws Exception{ Include i0 = new Include("x/*"); Matcher m = i0.createMatcher(); assertFalse(m.matchesAllChildren()); assertTrue(m.next("x").matchesAllChildren()); Include i1 = new Include("x/**"); m = i1.createMatcher(); assertFalse(m.matchesAllChildren()); assertTrue(m.next("x").matchesAllChildren()); }