use of org.molgenis.api.model.Query in project molgenis by molgenis.
the class QueryRsqlVisitorTest method testVisitComparisonNodeLessThan.
@ParameterizedTest
@MethodSource("testVisitComparisonNodeLessThanProvider")
void testVisitComparisonNodeLessThan(String symbol) {
String selector = "age";
String argument = "87";
ComparisonOperator operator = new ComparisonOperator(symbol);
ComparisonNode node = new ComparisonNode(operator, selector, singletonList(argument));
Query query = Query.builder().setItem(selector).setOperator(LESS_THAN).setValue(argument).build();
assertEquals(query, queryRsqlVisitor.visit(node));
}
use of org.molgenis.api.model.Query in project molgenis by molgenis.
the class QueryRsqlVisitorTest method testVisitComparisonNodeIn.
@Test
void testVisitComparisonNodeIn() {
String selector = "name";
List<String> arguments = asList("jan", "piet");
ComparisonOperator operator = new ComparisonOperator("=in=", true);
ComparisonNode node = new ComparisonNode(operator, selector, arguments);
Query query = Query.builder().setItem(selector).setOperator(IN).setValue(arguments).build();
assertEquals(query, queryRsqlVisitor.visit(node));
}
use of org.molgenis.api.model.Query in project molgenis by molgenis.
the class QueryRsqlVisitorTest method testVisitComparisonNodeGreaterThan.
@ParameterizedTest
@MethodSource("testVisitComparisonNodeGreaterThanProvider")
void testVisitComparisonNodeGreaterThan(String symbol) {
String selector = "age";
String argument = "87";
ComparisonOperator operator = new ComparisonOperator(symbol);
ComparisonNode node = new ComparisonNode(operator, selector, singletonList(argument));
Query query = Query.builder().setItem(selector).setOperator(GREATER_THAN).setValue(argument).build();
assertEquals(query, queryRsqlVisitor.visit(node));
}
use of org.molgenis.api.model.Query in project molgenis by molgenis.
the class QueryRsqlVisitorTest method testVisitComparisonNodeEqualsNull.
@Test
void testVisitComparisonNodeEqualsNull() {
String selector = "name";
String argument = "";
ComparisonOperator operator = new ComparisonOperator("==");
ComparisonNode node = new ComparisonNode(operator, selector, singletonList(argument));
Query query = Query.builder().setItem(selector).setOperator(EQUALS).setValue(null).build();
assertEquals(query, queryRsqlVisitor.visit(node));
}
use of org.molgenis.api.model.Query in project molgenis by molgenis.
the class QueryRsqlVisitorTest method testVisitComparisonNodeMatchesAllSelector.
@Test
void testVisitComparisonNodeMatchesAllSelector() {
String selector = "*";
String argument = "piet";
ComparisonOperator operator = new ComparisonOperator("=q=");
ComparisonNode node = new ComparisonNode(operator, selector, singletonList(argument));
Query query = Query.builder().setItem(null).setOperator(MATCHES).setValue(argument).build();
assertEquals(query, queryRsqlVisitor.visit(node));
}
Aggregations