/**
* Tests the createAggregationColumnDescription.
*/
public void testCreateAggregationColumnDescription() {
ColumnDescription columnDescription = new ColumnDescription("id",
ValueType.TEXT, "label");
ColumnTitle columnTitleCount = new ColumnTitle(Lists.<Value>newArrayList(),
new AggregationColumn(new SimpleColumn("id"),
AggregationType.COUNT), false);
ColumnTitle columnTitleMin = new ColumnTitle(Lists.<Value>newArrayList(),
new AggregationColumn(new SimpleColumn("id"),
AggregationType.MIN), true);
ColumnTitle columnTitleCountWithPivot =
new ColumnTitle(Lists.newArrayList(new NumberValue(3.14),
BooleanValue.TRUE), new AggregationColumn(new SimpleColumn("id"),
AggregationType.COUNT), false);
ColumnTitle columnTitleMinWithPivot =
new ColumnTitle(Lists.newArrayList(new NumberValue(3.14),
BooleanValue.TRUE), new AggregationColumn(new SimpleColumn("id"),
AggregationType.MIN), true);
ColumnDescription resultColumnDescriptionCount =
columnTitleCount.createAggregationColumnDescription(columnDescription);
ColumnDescription resultColumnDescriptionMin =
columnTitleMin.createAggregationColumnDescription(columnDescription);
ColumnDescription resultColumnDescriptionCountWithPivot =
columnTitleCountWithPivot.createAggregationColumnDescription(columnDescription);
ColumnDescription resultColumnDescriptionMinWithPivot =
columnTitleMinWithPivot.createAggregationColumnDescription(columnDescription);
// Check the creation of result column description with aggregation
// type count.
assertEquals("count-id", resultColumnDescriptionCount.getId());
assertEquals("count label", resultColumnDescriptionCount.getLabel());
assertEquals(ValueType.NUMBER, resultColumnDescriptionCount.getType());
// Check the creation of result column description with aggregation
// type min.
assertEquals("min-id", resultColumnDescriptionMin.getId());
assertEquals("min label", resultColumnDescriptionMin.getLabel());
assertEquals(ValueType.TEXT, resultColumnDescriptionMin.getType());
// Check the creation of result column description with aggregation
// type count with pivot and single aggregation.
assertEquals("3.14,true count-id", resultColumnDescriptionCountWithPivot.getId());
assertEquals("3.14,true", resultColumnDescriptionCountWithPivot.getLabel());
assertEquals(ValueType.NUMBER, resultColumnDescriptionCountWithPivot.getType());
// Check the creation of result column description with aggregation
// type min with pivot, multi-aggregation.
assertEquals("3.14,true min-id",
resultColumnDescriptionMinWithPivot.getId());
assertEquals("3.14,true min label",
resultColumnDescriptionMinWithPivot.getLabel());
assertEquals(ValueType.TEXT, resultColumnDescriptionMinWithPivot.getType());
}