public void testFormatAndLabelOnPivotColumns() throws Exception {
Query query = new Query();
QuerySelection selection = new QuerySelection(); // SELECT (sum(sales) / 7)
List<AbstractColumn> columns = Lists.newArrayList();
columns.add(new AggregationColumn(new SimpleColumn("Sales"), AggregationType.SUM));
columns.add(new ScalarFunctionColumn(Lists.<AbstractColumn>newArrayList(),
new Constant(new NumberValue(7))));
AbstractColumn selectedColumn = new ScalarFunctionColumn(columns, Quotient.getInstance());
selection.addColumn(selectedColumn);
query.setSelection(selection);
QueryGroup group = new QueryGroup();
group.addColumn(new SimpleColumn("Year"));
query.setGroup(group);
QueryPivot pivot = new QueryPivot();
pivot.addColumn(new SimpleColumn("Band"));
pivot.addColumn(new SimpleColumn("Songs"));
query.setPivot(pivot);
QueryLabels labels = new QueryLabels();
labels.addLabel(selectedColumn, "foo");
query.setLabels(labels);
QueryFormat format = new QueryFormat();