TreeMatcher { public boolean matches() { return _pattern.matches(_tree); } private  TreeMatcher(final TreePattern<V> pattern, final Tree<V, ?> tree); TreePattern<V> pattern(); Tree<V, ?> tree(); boolean matches(); Stream<TreeMatchResult<V>> results();  }
@Test(dataProvider = "patterns") public void matches( final String patternString, final String treeString, final boolean matches ) { final TreePattern<String> pattern = TreePattern.compile(patternString); final Tree<String, ?> tree = TreeNode.parse(treeString); final TreeMatcher<String> matcher = pattern.matcher(tree); Assert.assertEquals( matcher.matches(), matches, format("%s -> %s: %s", patternString, treeString, matches) ); }