// 4. check if all items are found
col = broker.getCollectionByQuery(query);
assertEquals("size of collection should be four", 4, col.size());
NumberRange range = new NumberRange(a1.getArticleId(), a5.getArticleId());
Iterator iter = col.iterator();
while (iter.hasNext())
{
InterfaceArticle testIa = (InterfaceArticle) iter.next();
assertEquals("should be same value", name, testIa.getArticleName());
Integer id = testIa.getArticleId();
assertTrue("Id should be a number of the generated articles", range.containsInteger(id));
}
// read one item only
// 1. set query start equals end
query.setStartAtIndex(4);
query.setEndAtIndex(4);
// 2. check if only one item is found
OJBIterator ojbIter = (OJBIterator)broker.getIteratorByQuery(query);
assertEquals("size of iterator should be one", 1, ojbIter.size());
InterfaceArticle test4 = (InterfaceArticle) ojbIter.next();
ojbIter.releaseDbResources();
assertTrue("Id should be a number of the generated articles", range.containsInteger(test4.getArticleId()));
}