### Question:
RoleDAO extends DefaultDAOBase<Integer, Role> { public List<Privilege> findPrivilegesByIdRole(final Integer idRole) { Query query = getSession().createQuery(QUERY_PRIVILEGES_FROM_ROLE); query.setInteger("idRole", idRole); List<Privilege> privileges = query.list(); return privileges; } RoleDAO();  RoleDAO(final EntityManager entityManager); static Criterion sameEnterpriseOrNull(final Enterprise enterprise); static Criterion sameEnterprise(final Enterprise enterprise); static Criterion genericRole(); Collection<Role> find(final Enterprise enterprise, final String filter,
        final String orderBy, final boolean desc); Collection<Role> find(final Enterprise enterprise, final String filter,
        final String orderBy, final boolean desc, final Integer offset, final Integer numResults); Collection<Role> find(final Enterprise enterprise, final String filter,
        final String orderBy, final boolean desc, final Integer offset, final Integer numResults,
        final boolean discardNullEnterprises); Collection<Role> findExactly(final Enterprise enterprise, final String filter,
        final String orderBy, final boolean desc, final Integer offset, final Integer numResults,
        final boolean discardNullEnterprises); List<Privilege> findPrivilegesByIdRole(final Integer idRole);  }### Answer:
@Test public void findPrivilegesByRole() { Privilege p1 = this.privilegeGenerator.createInstance(); Privilege p2 = this.privilegeGenerator.createInstance(); Role role = eg().createInstance(p1, p2); ds().persistAll(p1, p2, role); RoleDAO dao = createDaoForRollbackTransaction(); List<Privilege> privileges = dao.findPrivilegesByIdRole(role.getId()); AssertEx.assertSize(privileges, 2); }