use of org.immutables.criteria.expression.DebugExpressionVisitor in project immutables by immutables.
the class NestedTest method assertExpressional.
private static void assertExpressional(Criterion<?> crit, String... expectedLines) {
final StringWriter out = new StringWriter();
final Query query = Criterias.toQuery(crit);
query.filter().ifPresent(f -> f.accept(new DebugExpressionVisitor<>(new PrintWriter(out))));
final String expected = Arrays.stream(expectedLines).collect(Collectors.joining(System.lineSeparator()));
Assertions.assertEquals(expected, out.toString().trim());
}
use of org.immutables.criteria.expression.DebugExpressionVisitor in project immutables by immutables.
the class ExpressionAsStringTest method assertExpressional.
private static void assertExpressional(Criterion<?> crit, String... expectedLines) {
final StringBuilder out = new StringBuilder();
Query query = Criterias.toQuery(crit);
query.filter().ifPresent(f -> f.accept(new DebugExpressionVisitor<>(out)));
final String expected = Arrays.stream(expectedLines).collect(Collectors.joining(System.lineSeparator()));
Assertions.assertEquals(expected, out.toString().trim());
}
use of org.immutables.criteria.expression.DebugExpressionVisitor in project immutables by immutables.
the class AggregationExpressionTest method assertProjection.
private static void assertProjection(Aggregation<?> aggregation, String... expectedLines) {
Expression expression = Matchers.toExpression(aggregation);
String out = expression.accept(new DebugExpressionVisitor<>(new StringBuilder())).toString();
final String expected = Arrays.stream(expectedLines).collect(Collectors.joining(System.lineSeparator()));
Assertions.assertEquals(expected, out.trim());
}
Aggregations