public void testSimpleGroupBy() throws Exception {
Query q = new Query();
q.from(new FromItem(table2).setAlias("r"));
Column roleColumn = table2.getColumnByName(COLUMN_ROLE_ROLE_NAME);
q.select(new SelectItem(roleColumn));
q.groupBy(new GroupByItem(new SelectItem(roleColumn)));
assertEquals("SELECT r.name FROM MetaModelSchema.role r GROUP BY r.name", q.toString());
DataContext dc = getDataContext();
DataSet data = dc.executeQuery(q);
assertEquals(1, data.getSelectItems().length);