NamedSelector selector = new NamedSelector(selectorName("tableA"));
Constraint constraint = parser.parseConstraint(tokens("ISSAMENODE('/a/b/c') AND CONTAINS(p1,term1) AND CONTAINS(p2,term2)"),
typeSystem,
selector);
assertThat(constraint, is(instanceOf(And.class)));
And and = (And)constraint;
assertThat(and.left(), is(instanceOf(SameNode.class)));
SameNode same = (SameNode)and.left();
assertThat(same.selectorName(), is(selectorName("tableA")));
assertThat(same.getPath(), is("/a/b/c"));
assertThat(and.right(), is(instanceOf(And.class)));
And secondAnd = (And)and.right();
assertThat(secondAnd.left(), is(instanceOf(FullTextSearch.class)));
FullTextSearch search1 = (FullTextSearch)secondAnd.left();
assertThat(search1.selectorName(), is(selectorName("tableA")));
assertThat(search1.getPropertyName(), is("p1"));
assertThat(search1.fullTextSearchExpression(), is("term1"));
assertThat(secondAnd.right(), is(instanceOf(FullTextSearch.class)));
FullTextSearch search2 = (FullTextSearch)secondAnd.right();
assertThat(search2.selectorName(), is(selectorName("tableA")));
assertThat(search2.getPropertyName(), is("p2"));
assertThat(search2.fullTextSearchExpression(), is("term2"));
}