use of cz.jirutka.rsql.parser.ast.Node in project tutorials by eugenp.
the class RsqlIntegrationTest method givenMinAge_whenGettingListOfUsers_thenCorrect.
@Test
public void givenMinAge_whenGettingListOfUsers_thenCorrect() {
final Node rootNode = new RSQLParser().parse("age>25");
final Specification<User> spec = rootNode.accept(new CustomRsqlVisitor<User>());
final List<User> results = repository.findAll(spec);
assertThat(userTom, isIn(results));
assertThat(userJohn, not(isIn(results)));
}
use of cz.jirutka.rsql.parser.ast.Node in project tutorials by eugenp.
the class RsqlIntegrationTest method givenFirstAndLastName_whenGettingListOfUsers_thenCorrect.
@Test
public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() {
final Node rootNode = new RSQLParser().parse("firstName==john;lastName==doe");
final Specification<User> spec = rootNode.accept(new CustomRsqlVisitor<User>());
final List<User> results = repository.findAll(spec);
assertThat(userJohn, isIn(results));
assertThat(userTom, not(isIn(results)));
}
use of cz.jirutka.rsql.parser.ast.Node in project tutorials by eugenp.
the class RsqlIntegrationTest method givenFirstNamePrefix_whenGettingListOfUsers_thenCorrect.
@Test
public void givenFirstNamePrefix_whenGettingListOfUsers_thenCorrect() {
final Node rootNode = new RSQLParser().parse("firstName==jo*");
final Specification<User> spec = rootNode.accept(new CustomRsqlVisitor<User>());
final List<User> results = repository.findAll(spec);
assertThat(userJohn, isIn(results));
assertThat(userTom, not(isIn(results)));
}
Aggregations