### Question:
UserDAO extends DefaultDAOBase<Integer, User> { public Collection<User> find(final Enterprise enterprise, final String filter, final String orderBy, final boolean desc) { return find(enterprise, null, filter, orderBy, desc, false, 0, 25); } UserDAO();  UserDAO(final EntityManager entityManager); static Criterion sameEnterprise(final Enterprise enterprise); static Criterion sameId(final Integer userId); static Criterion sameNick(final String nick); static Criterion sameRole(final Role role); Collection<User> findByRole(final Role role); Collection<User> findByEnterprise(final Enterprise enterprise); User findByEnterprise(final Integer userId, final Enterprise enterprise); Collection<User> find(final Enterprise enterprise, final String filter,
        final String orderBy, final boolean desc); Collection<User> find(final Enterprise enterprise, final Role role, final String filter,
        final String orderBy, final boolean desc, final boolean connected, final Integer offset,
        final Integer numResults); boolean existAnyUserWithNick(final String nick); boolean existAnyOtherUserWithNick(final User user, final String nick); User getAbiquoUserByLogin(final String login); User getUserByAuth(final String login, final AuthType authType); static Criterion sameAuthType(final AuthType authType); boolean existAnyUserWithNickAndAuth(final String nick, final AuthType authType); boolean existAnyUserWithRole(final Role role); @SuppressWarnings("rawtypes") boolean isUserAllowedToUseVirtualDatacenter(final String username,
        final String authtype, final String[] privileges, final Integer idVdc); @SuppressWarnings("rawtypes") boolean isUserAllowedToEnterprise(final String username, final String authtype,
        final String[] privileges, final Integer ident);  }### Answer:
@Test public void findConnected() { User user = eg().createUserWithSession(); User userWithoutSession = eg().createInstance(user.getEnterprise(), user.getRole()); List<Object> entitiesToPersist = new ArrayList<Object>(); for (Privilege privilege : user.getRole().getPrivileges()) { entitiesToPersist.add(privilege); } entitiesToPersist.add(user.getEnterprise()); entitiesToPersist.add(user.getRole()); entitiesToPersist.add(user); entitiesToPersist.add(userWithoutSession); ds().persistAll(entitiesToPersist.toArray()); UserDAO dao = createDaoForRollbackTransaction(); Collection<User> users = dao.find(user.getEnterprise(), null, null, null, false, true, 0, 25); AssertEx.assertSize(users, 1); users = dao.find(null, null, null, null, false, true, 0, 25); AssertEx.assertSize(users, 1); users = dao.find(user.getEnterprise(), null, null, null, false, false, 0, 25); AssertEx.assertSize(users, 2); }