Test coverage for Query with groupBy