### Question:
CostCodeDAO extends DefaultDAOBase<Integer, CostCode> { public Collection<CostCode> find(final String filter, final String orderBy, final boolean desc, final int offset, int numResults) { Criteria criteria = createCriteria(filter, orderBy, desc); Long total = count(criteria); criteria = createCriteria(filter, orderBy, desc); numResults = (int) (numResults != 0 ? numResults : total); if (numResults != 0) { criteria.setFirstResult(offset * numResults); criteria.setMaxResults(numResults); } List<CostCode> result = getResultList(criteria); PagedList<CostCode> page = new PagedList<CostCode>(); page.addAll(result); if (numResults != 0) { page.setCurrentElement(offset); page.setPageSize(numResults); } page.setTotalResults(total.intValue()); return page; } CostCodeDAO();  CostCodeDAO(final EntityManager entityManager); static Criterion sameName(final String name); boolean existAnyOtherCostCodeWithName(final CostCode costCode, final String name); boolean existAnyOtherCostCodeWithName(final String name); Collection<CostCode> find(final String filter, final String orderBy, final boolean desc,
        final int offset, int numResults);  }### Answer:
@Test public void findCostCodes() { CostCode c1 = eg().createUniqueInstance(); CostCode c2 = eg().createUniqueInstance(); ds().persistAll(c1, c2); CostCodeDAO dao = createDaoForRollbackTransaction(); Collection<CostCode> costCodes = dao.find(null, null, false, 0, 25); AssertEx.assertSize(costCodes, 2); }