/**
* Tests the building of the SQL query ORDER BY clause from the Gviz query.
*/
public void testBuildOrderByClause() {
Query query = new Query();
QuerySort querySort = new QuerySort();
AggregationColumn column1 =
new AggregationColumn(new SimpleColumn("ID"), AggregationType.COUNT);
SimpleColumn column2 = new SimpleColumn("FNAME");
querySort.addSort(column1, SortOrder.DESCENDING);
querySort.addSort(column2, SortOrder.ASCENDING);
query.setSort(querySort);
StrBuilder queryStringBuilder = new StrBuilder();
SqlDataSourceHelper.appendOrderByClause(query, queryStringBuilder);
assertEquals(queryStringBuilder.toString(),
"ORDER BY count(`ID`) DESC, `FNAME` ",