As described in Chapter 23, Writing Acceptance Tests and Building a Visual Prototype, keeping data retrieval separate from business logic is very often a reasonable choice, which makes it possible to swap several kinds of backends (SQL, web service, and so on) without having to change the business rules. Additionally, using a lightweight, fake data backend (a so-called test double) in tests makes them run fast.
For these reasons, while writing the test for the usecase, we introduced a data repository object that would both function as a data feed for the GroceryItems entity (groceryItems->setRepository(groceryItemsRepoDummy)) and give an oracle against which we could check if all data was loaded (QCOMPARE ...