{
// 7 articles, 2 books, 3 cds
Criteria criteria = new Criteria();
criteria.addEqualTo("productGroupId", new Integer(5));
Query query = QueryFactory.newQuery(Article.class, criteria);
ReportQueryByCriteria reportQuery;
Iterator iter = broker.getIteratorByQuery(query);
Collection result = new Vector();
InterfaceArticle article;
int count;
while (iter.hasNext())
{
article = (InterfaceArticle) iter.next();
result.add(article);
}
assertEquals("Iterator should produce 12 items", 12, result.size());
// get count
count = broker.getCount(query);
assertEquals("Count should be 12", 12, count);
reportQuery = QueryFactory.newReportQuery(Article.class, criteria);
reportQuery.setAttributes(new String[]{"count(*)"});
iter = broker.getReportQueryIteratorByQuery(reportQuery);
while (iter.hasNext())
{
result.add(iter.next());