Query q = new Query();
q.from(table2, "c");
Column roleColumn = table2.getColumnByName(COLUMN_ROLE_ROLE_NAME);
Column contributorIdColumn = table2.getColumnByName(COLUMN_ROLE_CONTRIBUTOR_ID);
q.groupBy(roleColumn);
SelectItem countSelectItem = new SelectItem(FunctionType.COUNT, contributorIdColumn).setAlias("my_count");
q.select(new SelectItem(roleColumn));
q.having(new FilterItem(countSelectItem, OperatorType.GREATER_THAN, 3));
assertEquals("SELECT c.name FROM MetaModelSchema.role c GROUP BY c.name HAVING COUNT(c.contributor_id) > 3",
q.toString());