RelationParser { static Parser<OrderBy> orderByClause(Parser<Expression> expr) { return TerminalParser.phrase("order by").next(list(orderByItem(expr))).map(OrderBy::new); }  static Parser<Relation> query();  }
@Test public void testOrderByClause() { Parser<OrderBy> parser = RelationParser.orderByClause(ExpressionParser.NUMBER); TerminalParserTest.assertParser(parser, "order by 1, 2 desc, 3 asc", new OrderBy(Arrays.asList( new OrderBy.Item(ExpressionParserTest.number(1), true), new OrderBy.Item(ExpressionParserTest.number(2), false), new OrderBy.Item(ExpressionParserTest.number(3), true)))); }