SolutionModifierHandler implements Handler { public void setOffset(int offset) { query.setOffset(offset < 1 ? Query.NOLIMIT : offset); } 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 testSetOffset() { solutionModifier.setOffset(500); String[] s = byLine(query.toString()); assertContainsRegex("OFFSET\\s+500", s); solutionModifier.setOffset(200); s = byLine(query.toString()); assertContainsRegex("OFFSET\\s+200", s); solutionModifier.setOffset(-1); s = byLine(query.toString()); assertNotContainsRegex("OFFSET.*", s); }