/** * @return selectExpression */ public String getSelectExpression() { return this.selectExpression.getSelectExpression(); }
@Test public void shouldCompileExpressionWithExtraWhitespace() { expr = PathExpression.compile(" /a/b/c "); assertThat(expr, is(notNullValue())); assertThat(expr.getSelectExpression(), is("/a/b/c")); expr = PathExpression.compile(" /a/b/c "); assertThat(expr, is(notNullValue())); assertThat(expr.getSelectExpression(), is("/a/b/c")); }
@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 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)); }