### Question:
CostCodeCurrencyDAO extends DefaultDAOBase<Integer, CostCodeCurrency> { public Collection<CostCodeCurrency> find(final CostCode cc, final Currency currency) { Criteria criteria = createCriteria(); if (cc != null) { criteria.add(sameCostCode(cc)); } else if (currency != null) { criteria.add(sameCurrency(currency)); } return criteria.list(); } CostCodeCurrencyDAO();  CostCodeCurrencyDAO(final EntityManager entityManager); CostCodeCurrency findCurrencyCostCode(final CostCode costCode, final Currency currency); boolean existAnyOtherWithCurrency(final CostCodeCurrency costCodeCurrency,
        final Currency currency, final CostCode costCode); Collection<CostCodeCurrency> find(final CostCode cc, final Currency currency); @SuppressWarnings("unchecked") List<CostCode> findCostCodesIds();  }### Answer:
@Test public void findCostCodeCurrencies() { CostCodeCurrency c1 = eg().createUniqueInstance(); CostCodeCurrency c2 = eg().createUniqueInstance(); ds().persistAll(c1.getCurrency(), c1.getCostCode(), c1, c2.getCurrency(), c2.getCostCode(), c2); CostCodeCurrencyDAO dao = createDaoForRollbackTransaction(); Collection<CostCodeCurrency> ccs = dao.find(c1.getCostCode(), null); AssertEx.assertSize(ccs, 1); ccs = dao.find(c2.getCostCode(), null); AssertEx.assertSize(ccs, 1); }