SolutionModifierHandler implements Handler { public void addOrderBy(SortCondition condition) { query.addOrderBy(condition); } SolutionModifierHandler(Query query); void addAll(SolutionModifierHandler solutionModifier); void addOrderBy(SortCondition condition); void addOrderBy(Expr expr); void addOrderBy(Expr expr, Order order); void addOrderBy(Var var); void addOrderBy(Var var, Order order); void addGroupBy(Expr expr); void addGroupBy(Var var); void addGroupBy(Var var, Expr expr); void addHaving(String expression); void addHaving(Var var); void addHaving(Expr expr); void setLimit(int limit); void setOffset(int offset); @Override void setVars(Map<Var, Node> values); @Override void build();  }
@Test public void testAddOrderBy() { solutionModifier.addOrderBy(Var.alloc("orderBy")); List<SortCondition> sc = query.getOrderBy(); assertEquals("Wrong number of conditions", 1, sc.size()); assertEquals("Wrong value", sc.get(0).expression.asVar(), Var.alloc("orderBy")); solutionModifier.addOrderBy(Var.alloc("orderBy2")); sc = query.getOrderBy(); assertEquals("Wrong number of conditions", 2, sc.size()); assertEquals("Wrong value", sc.get(0).expression.asVar(), Var.alloc("orderBy")); assertEquals("Wrong value", sc.get(1).expression.asVar(), Var.alloc("orderBy2")); }