UserDaoImpl implements UserDao { @Override public List<User> findUsersInGroup(final String groupUuid, final String quickFilterInput) { final Predicate<User> quickFilterPredicate = buildQuickFilterPredicate(quickFilterInput); return JooqUtil.contextResult(securityDbConnProvider, context -> context.select() .from(STROOM_USER) .join(STROOM_USER_GROUP) .on(STROOM_USER.UUID.eq(STROOM_USER_GROUP.USER_UUID)) .where(STROOM_USER_GROUP.GROUP_UUID.eq(groupUuid)) .and(getExcludedUsersCondition()) .orderBy(STROOM_USER.NAME) .fetch() .stream() .map(RECORD_TO_USER_MAPPER) .filter(quickFilterPredicate) .collect(Collectors.toList())); } @Inject  UserDaoImpl(final ProcessingUserIdentityProvider processingUserIdentityProvider,
                       final SecurityDbConnProvider securityDbConnProvider); @Override User create(final User user); @Override Optional<User> getById(final int id); @Override Optional<User> getByUuid(final String uuid); @Override Optional<User> getByName(final String name); @Override User update(final User user); @Override void delete(final String uuid); @Override List<User> find(final String quickFilterInput, final Boolean group); @Override List<User> findUsersInGroup(final String groupUuid, final String quickFilterInput); @Override List<User> findGroupsForUser(final String userUuid, final String quickFilterInput); @Override Set<String> findGroupUuidsForUser(final String userUuid); @Override List<User> findGroupsForUserName(final String userName); @Override void addUserToGroup(final String userUuid,
                               final String groupUuid); @Override void removeUserFromGroup(final String userUuid,
                                    final String groupUuid);  }
@Test void findUsersInGroup() { final List<String> userNames = IntStream.range(0, 3) .mapToObj(i -> String.format("SomePerson_%s", UUID.randomUUID())) .collect(Collectors.toList()); final String groupName = String.format("SomeGroup_%s", UUID.randomUUID()); final User group = createUser(groupName, true); final List<User> users = userNames.stream() .map(name -> createUser(name, false)) .peek(u -> userDao.addUserToGroup(u.getUuid(), group.getUuid())) .collect(Collectors.toList()); final List<User> usersInGroup = userDao.findUsersInGroup(group.getUuid(), null); userNames.forEach(userName -> { assertThat(users.stream() .anyMatch(u -> userName.equals(u.getName()))).isTrue(); assertThat(usersInGroup.stream() .anyMatch(u -> userName.equals(u.getName()))).isTrue(); }); }