@Test public void shouldMatchStringWithRepositoryAndWorkspaceUsingExpressionWithBlankRepositoryAndBlankWorkspace() { expr = PathExpression.compile(":://a/b"); assertThat(expr.matcher("repo:workspace:/a").matches(), is(false)); assertThat(expr.matcher("repo:workspace:/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/y/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace2:/a").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace2:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace2:/x/y/a/b").matches(), is(true)); }
@Test public void shouldMatchExpressionsWithoutRegardToCase() { expr = PathExpression.compile("/a/b/c/d/e[@something]"); assertThat(expr.matcher("/a/b/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/e/@something").getInputPath(), is("/a/b/c/d/e/@something")); assertThat(expr.matcher("/a/b/c/d/e/@something").getSelectedNodePath(), is("/a/b/c/d/e")); assertThat(expr.matcher("/a/b/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b/c/d/E/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/E/@something").getInputPath(), is("/a/b/c/d/E/@something")); assertThat(expr.matcher("/a/b/c/d/E/@something").getSelectedNodePath(), is("/a/b/c/d/E")); assertThat(expr.matcher("/a/b/c/d/E/@something").groupCount(), is(0)); }
@Test public void shouldMatchStringWithRepositoryAndWorkspaceUsingExpressionWithoutRepositoryOrWorkspace() { expr = PathExpression.compile("//a/b"); assertThat(expr.matcher("repo:workspace:/a").matches(), is(false)); assertThat(expr.matcher("repo:workspace:/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/y/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace2:/a").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace2:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace2:/x/y/a/b").matches(), is(true)); }
@Test public void shouldMatchExpressionsWithExactFullPathAndExtraPathInsideMatch() { expr = PathExpression.compile("/a/b/c[d/e/@something]"); assertThat(expr.matcher("/a/b/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/e/@something").getInputPath(), is("/a/b/c/d/e/@something")); assertThat(expr.matcher("/a/b/c/d/e/@something").getSelectedNodePath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b/c/d/E/@something2").matches(), is(false)); assertThat(expr.matcher("/a/b/c/d/ex/@something").matches(), is(false)); assertThat(expr.matcher("/a/b[1]/c/d/e/@something").matches(), is(false)); }
@Test public void shouldMatchExpressionsWithExactFullPath() { expr = PathExpression.compile("/a/b/c/d/e[@something]"); assertThat(expr.matcher("/a/b/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/e/@something").getInputPath(), is("/a/b/c/d/e/@something")); assertThat(expr.matcher("/a/b/c/d/e/@something").getSelectedNodePath(), is("/a/b/c/d/e")); assertThat(expr.matcher("/a/b/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b/c/d/E/@something2").matches(), is(false)); assertThat(expr.matcher("/a/b/c/d/ex/@something").matches(), is(false)); assertThat(expr.matcher("/a/b[1]/c/d/e/@something").matches(), is(false)); }
@Test public void shouldMatchExpressionsWithExtraLargeSegmentWildcardAtEnd() { expr = PathExpression.compile("/a/b/c////"); assertThat(expr.matcher("/a/b/c").matches(), is(true)); assertThat(expr.matcher("/a/b/c").getInputPath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c").getSelectedNodePath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c").groupCount(), is(0)); }
@Test public void shouldMatchStringWithRepositoryAndWorkspaceUsingExpressionWithRepositoryAndBlankWorkspace() { expr = PathExpression.compile("repo:://a/b"); assertThat(expr.matcher("repo:workspace:/a").matches(), is(false)); assertThat(expr.matcher("repo:workspace:/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/y/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace2:/a").matches(), is(false)); assertThat(expr.matcher("repo:workspace2:/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace2:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace2:/x/y/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace2:/a").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/a/b").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/x/a/b").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/x/y/a/b").matches(), is(false)); }
@Test public void shouldCompileExpressionWithAnyNode() { expr = PathExpression.compile("/*"); assertThat(expr.getSelectExpression(), is("/*")); assertThat(expr.matcher("/a").matches(), is(true)); assertThat(expr.matcher("/a").getInputPath(), is("/a")); assertThat(expr.matcher("/a").getSelectedNodePath(), is("/a")); assertThat(expr.matcher("/a").groupCount(), is(0)); }
@Test public void shouldMatchStringWithRepositoryAndWorkspaceUsingExpressionWithRepositoryAndWorkspace() { expr = PathExpression.compile("repo:workspace://a/b"); assertThat(expr.matcher("repo:workspace:/a").matches(), is(false)); assertThat(expr.matcher("repo:workspace:/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/y/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace2:/a").matches(), is(false)); assertThat(expr.matcher("repo:workspace2:/a/b").matches(), is(false)); assertThat(expr.matcher("repo:workspace2:/x/a/b").matches(), is(false)); assertThat(expr.matcher("repo:workspace2:/x/y/a/b").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/a").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/a/b").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/x/a/b").matches(), is(false)); assertThat(expr.matcher("repo1:workspace2:/x/y/a/b").matches(), is(false)); }
@Test public void shouldMatchStringWithRepositoryAndWorkspaceUsingExpressionWithBlankRepositoryAndWorkspace() { expr = PathExpression.compile(":workspace://a/b"); assertThat(expr.matcher("repo:workspace:/a").matches(), is(false)); assertThat(expr.matcher("repo:workspace:/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace:/x/y/a/b").matches(), is(true)); assertThat(expr.matcher("repo:workspace2:/a").matches(), is(false)); assertThat(expr.matcher("repo:workspace2:/a/b").matches(), is(false)); assertThat(expr.matcher("repo:workspace2:/x/a/b").matches(), is(false)); assertThat(expr.matcher("repo:workspace2:/x/y/a/b").matches(), is(false)); assertThat(expr.matcher("repo1:workspace:/a").matches(), is(false)); assertThat(expr.matcher("repo1:workspace:/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace:/x/a/b").matches(), is(true)); assertThat(expr.matcher("repo1:workspace:/x/y/a/b").matches(), is(true)); } }
@Test public void shouldMatchExpressionsWithWildcardSelection() { expr = PathExpression.compile("/a/*/c[d/e/@something]"); assertThat(expr.matcher("/a/b/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/e/@something").getInputPath(), is("/a/b/c/d/e/@something")); assertThat(expr.matcher("/a/b/c/d/e/@something").getSelectedNodePath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").getInputPath(), is("/a/b[2]/c/d/e/@something")); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").getSelectedNodePath(), is("/a/b[2]/c")); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/rt/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/rt/c/d/e/@something").getInputPath(), is("/a/rt/c/d/e/@something")); assertThat(expr.matcher("/a/rt/c/d/e/@something").getSelectedNodePath(), is("/a/rt/c")); assertThat(expr.matcher("/a/rt/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/ac/d/e/@something").matches(), is(false)); assertThat(expr.matcher("/a/d/e/@something").matches(), is(false)); assertThat(expr.matcher("/a/b/b2/b3/d/e/@something").matches(), is(false)); }
@Test public void shouldCompileExpressionWithAnySequenceOfNodes() { expr = PathExpression.compile("//"); assertThat(expr.getSelectExpression(), is("//")); assertThat(expr.matcher("/a").matches(), is(true)); assertThat(expr.matcher("/a").getInputPath(), is("/a")); assertThat(expr.matcher("/a").getSelectedNodePath(), is("/a")); assertThat(expr.matcher("/a").groupCount(), is(0)); assertThat(expr.matcher("/a/b").matches(), is(true)); assertThat(expr.matcher("/a/b").getInputPath(), is("/a/b")); assertThat(expr.matcher("/a/b").getSelectedNodePath(), is("/a/b")); assertThat(expr.matcher("/a/b").groupCount(), is(0)); assertThat(expr.matcher("/a/b/c").matches(), is(true)); assertThat(expr.matcher("/a/b/c").getInputPath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c").getSelectedNodePath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c").groupCount(), is(0)); }
@Test public void shouldMatchExpressionsWithSegmentWildcardAtEnd() { expr = PathExpression.compile("/a/b/c//"); assertThat(expr.matcher("/a/b/c").matches(), is(true)); assertThat(expr.matcher("/a/b/c").getInputPath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c").getSelectedNodePath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c").groupCount(), is(0)); assertThat(expr.matcher("/a/b/c/d").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d").getInputPath(), is("/a/b/c/d")); assertThat(expr.matcher("/a/b/c/d").getSelectedNodePath(), is("/a/b/c/d")); assertThat(expr.matcher("/a/b/c/d").groupCount(), is(0)); assertThat(expr.matcher("/a/b/c/a").matches(), is(true)); assertThat(expr.matcher("/a/b/c/a").getInputPath(), is("/a/b/c/a")); assertThat(expr.matcher("/a/b/c/a").getSelectedNodePath(), is("/a/b/c/a")); assertThat(expr.matcher("/a/b/c/a").groupCount(), is(0)); assertThat(expr.matcher("/a/b/c/d/e/f/g/h").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/e/f/g/h").getInputPath(), is("/a/b/c/d/e/f/g/h")); assertThat(expr.matcher("/a/b/c/d/e/f/g/h").getSelectedNodePath(), is("/a/b/c/d/e/f/g/h")); assertThat(expr.matcher("/a/b/c/d/e/f/g/h").groupCount(), is(0)); assertThat(expr.matcher("/a/b").matches(), is(false)); assertThat(expr.matcher("/a/b/d").matches(), is(false)); }
@Test public void shouldMatchExpressionsWithFilenameLikeWildcardSelection() { expr = PathExpression.compile("/a/*.txt[@something]"); assertThat(expr.matcher("/a/b.txt/@something").matches(), is(true)); assertThat(expr.matcher("/a/b.txt/@something").getInputPath(), is("/a/b.txt/@something")); assertThat(expr.matcher("/a/b.txt/@something").getSelectedNodePath(), is("/a/b.txt")); assertThat(expr.matcher("/a/b.txt/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b.tx/@something").matches(), is(false)); expr = PathExpression.compile("/a/*.txt/c[@something]"); assertThat(expr.matcher("/a/b.txt/c/@something").matches(), is(true)); assertThat(expr.matcher("/a/b.txt/c/@something").getInputPath(), is("/a/b.txt/c/@something")); assertThat(expr.matcher("/a/b.txt/c/@something").getSelectedNodePath(), is("/a/b.txt/c")); assertThat(expr.matcher("/a/b.txt/c/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b.tx/c/@something").matches(), is(false)); expr = PathExpression.compile("//*.txt[*]/c[@something]"); assertThat(expr.matcher("/a/b.txt/c/@something").matches(), is(true)); assertThat(expr.matcher("/a/b.txt/c/@something").getInputPath(), is("/a/b.txt/c/@something")); assertThat(expr.matcher("/a/b.txt/c/@something").getSelectedNodePath(), is("/a/b.txt/c")); assertThat(expr.matcher("/a/b.txt/c/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b.tx/c/@something").matches(), is(false)); assertThat(expr.matcher("/z/a/b.txt/c/@something").matches(), is(true)); assertThat(expr.matcher("/z/a/b.txt/c/@something").getInputPath(), is("/z/a/b.txt/c/@something")); assertThat(expr.matcher("/z/a/b.txt/c/@something").getSelectedNodePath(), is("/z/a/b.txt/c")); assertThat(expr.matcher("/z/a/b.txt/c/@something").groupCount(), is(0)); }
@Test public void shouldMatchExpressionsWithSegmentWildcardSelection() { expr = PathExpression.compile("/a//c[d/e/@something]"); assertThat(expr.matcher("/a/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/c/d/e/@something").getInputPath(), is("/a/c/d/e/@something")); assertThat(expr.matcher("/a/c/d/e/@something").getSelectedNodePath(), is("/a/c")); assertThat(expr.matcher("/a/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/e/@something").getInputPath(), is("/a/b/c/d/e/@something")); assertThat(expr.matcher("/a/b/c/d/e/@something").getSelectedNodePath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").getInputPath(), is("/a/b[2]/c/d/e/@something")); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").getSelectedNodePath(), is("/a/b[2]/c")); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/rt/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/rt/c/d/e/@something").getInputPath(), is("/a/rt/c/d/e/@something")); assertThat(expr.matcher("/a/rt/c/d/e/@something").getSelectedNodePath(), is("/a/rt/c")); assertThat(expr.matcher("/a/rt/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/r/s/t/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/r/s/t/c/d/e/@something").getInputPath(), is("/a/r/s/t/c/d/e/@something")); assertThat(expr.matcher("/a/r/s/t/c/d/e/@something").getSelectedNodePath(), is("/a/r/s/t/c")); assertThat(expr.matcher("/a/r/s/t/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/r[1]/s[2]/t[33]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/r[1]/s[2]/t[33]/c/d/e/@something").getInputPath(), is("/a/r[1]/s[2]/t[33]/c/d/e/@something")); assertThat(expr.matcher("/a/r[1]/s[2]/t[33]/c/d/e/@something").getSelectedNodePath(), is("/a/r[1]/s[2]/t[33]/c")); assertThat(expr.matcher("/a/r[1]/s[2]/t[33]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a[3]/c/d/e/@something").matches(), is(false)); }
@Test public void shouldMatchExpressionsWithRepositoryInSelectionPath() { expr = PathExpression.compile("reposA::/a/b/c[d/e/@something]"); assertThat(expr.matcher("reposA::/a/b/c/d/e/@something").matches(), is(true)); }
@Test public void shouldMatchExpressionWithFilenamePatternAndChildProperty() { expr = PathExpression.compile("//(*.(jpeg|gif|bmp|pcx|png|iff|ras|pbm|pgm|ppm|psd))[*]/jcr:content[@jcr:data]"); assertThat(expr.matcher("/a/b/caution.png/jcr:content/@jcr:data").matches(), is(true)); }
@Test public void shouldMatchExpressionsWithAnyIndexesInSelectionPaths() { expr = PathExpression.compile("/a/b[*]/c[]/d/e[@something]"); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").getInputPath(), is("/a/b[2]/c/d/e/@something")); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").getSelectedNodePath(), is("/a/b[2]/c/d/e")); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[3]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[3]/c/d/e/@something").getInputPath(), is("/a/b[3]/c/d/e/@something")); assertThat(expr.matcher("/a/b[3]/c/d/e/@something").getSelectedNodePath(), is("/a/b[3]/c/d/e")); assertThat(expr.matcher("/a/b[3]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[4]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[4]/c/d/e/@something").getInputPath(), is("/a/b[4]/c/d/e/@something")); assertThat(expr.matcher("/a/b[4]/c/d/e/@something").getSelectedNodePath(), is("/a/b[4]/c/d/e")); assertThat(expr.matcher("/a/b[4]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[5]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[5]/c/d/e/@something").getInputPath(), is("/a/b[5]/c/d/e/@something")); assertThat(expr.matcher("/a/b[5]/c/d/e/@something").getSelectedNodePath(), is("/a/b[5]/c/d/e")); assertThat(expr.matcher("/a/b[5]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[1]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[1]/c/d/e/@something").getInputPath(), is("/a/b[1]/c/d/e/@something")); assertThat(expr.matcher("/a/b[1]/c/d/e/@something").getSelectedNodePath(), is("/a/b[1]/c/d/e")); assertThat(expr.matcher("/a/b[1]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[6]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[6]/c/d/e/@something").getInputPath(), is("/a/b[6]/c/d/e/@something"));
@Test public void shouldMatchExpressionsWithIndexesInSelectionPaths() { expr = PathExpression.compile("/a/b[2,3,4,5]/c/d/e[@something]"); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").getInputPath(), is("/a/b[2]/c/d/e/@something")); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").getSelectedNodePath(), is("/a/b[2]/c/d/e")); assertThat(expr.matcher("/a/b[2]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[3]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[3]/c/d/e/@something").getInputPath(), is("/a/b[3]/c/d/e/@something")); assertThat(expr.matcher("/a/b[3]/c/d/e/@something").getSelectedNodePath(), is("/a/b[3]/c/d/e")); assertThat(expr.matcher("/a/b[3]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[4]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[4]/c/d/e/@something").getInputPath(), is("/a/b[4]/c/d/e/@something")); assertThat(expr.matcher("/a/b[4]/c/d/e/@something").getSelectedNodePath(), is("/a/b[4]/c/d/e")); assertThat(expr.matcher("/a/b[4]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[5]/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b[5]/c/d/e/@something").getInputPath(), is("/a/b[5]/c/d/e/@something")); assertThat(expr.matcher("/a/b[5]/c/d/e/@something").getSelectedNodePath(), is("/a/b[5]/c/d/e")); assertThat(expr.matcher("/a/b[5]/c/d/e/@something").groupCount(), is(0)); assertThat(expr.matcher("/a/b[1]/c/d/e/@something").matches(), is(false)); assertThat(expr.matcher("/a/b/c/d/e/@something").matches(), is(false)); assertThat(expr.matcher("/a[1]/b/c/d/e/@something").matches(), is(false)); assertThat(expr.matcher("/a/b/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/e/@something").getInputPath(), is("/a/b/c/d/e/@something")); assertThat(expr.matcher("/a/b/c/d/e/@something").getSelectedNodePath(), is("/a/b/c/d/e"));
@Test public void shouldMatchExpressionsWithNamedGroups() { expr = PathExpression.compile("/a(//c)[d/e/@something]"); assertThat(expr.matcher("/a/b/c/d/e/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/c/d/e/@something").getInputPath(), is("/a/b/c/d/e/@something")); assertThat(expr.matcher("/a/b/c/d/e/@something").getSelectedNodePath(), is("/a/b/c")); assertThat(expr.matcher("/a/b/c/d/e/@something").groupCount(), is(1)); assertThat(expr.matcher("/a/b/c/d/e/@something").group(0), is("/a/b/c/d/e/@something")); assertThat(expr.matcher("/a/b/c/d/e/@something").group(1), is("/b/c")); assertThat(expr.matcher("/a/b/e/f/g/@something").matches(), is(true)); assertThat(expr.matcher("/a/b/e/f/g/@something").getInputPath(), is("/a/b/e/f/g/@something")); assertThat(expr.matcher("/a/b/e/f/g/@something").getSelectedNodePath(), is("/a/b/e")); assertThat(expr.matcher("/a/b/e/f/g/@something").groupCount(), is(2)); assertThat(expr.matcher("/a/b/e/f/g/@something").group(0), is("/a/b/e/f/g/@something")); assertThat(expr.matcher("/a/b/e/f/g/@something").group(1), is("/b/e")); assertThat(expr.matcher("/a/b/e/f/g/@something").group(2), is("b")); assertThat(expr.matcher("/a/c/e/f/g/@something").matches(), is(true)); assertThat(expr.matcher("/a/c/e/f/g/@something").getInputPath(), is("/a/c/e/f/g/@something")); assertThat(expr.matcher("/a/c/e/f/g/@something").getSelectedNodePath(), is("/a/c/e")); assertThat(expr.matcher("/a/c/e/f/g/@something").groupCount(), is(2)); assertThat(expr.matcher("/a/c/e/f/g/@something").group(0), is("/a/c/e/f/g/@something")); assertThat(expr.matcher("/a/c/e/f/g/@something").group(1), is("/c/e")); assertThat(expr.matcher("/a/c/e/f/g/@something").group(2), is("c")); assertThat(expr.matcher("/a/d/e/f/g/@something").matches(), is(true)); assertThat(expr.matcher("/a/d/e/f/g/@something").getInputPath(), is("/a/d/e/f/g/@something")); assertThat(expr.matcher("/a/d/e/f/g/@something").getSelectedNodePath(), is("/a/d/e")); assertThat(expr.matcher("/a/d/e/f/g/@something").groupCount(), is(2));