@ApiOperation(value = "List groups", nickname="listGroups", tags = { "Groups" }, produces = "application/json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", dataType = "string", value = "Only return group with the given id", paramType = "query"),
            @ApiImplicitParam(name = "name", dataType = "string", value = "Only return groups with the given name", paramType = "query"),
            @ApiImplicitParam(name = "type", dataType = "string", value = "Only return groups with the given type", paramType = "query"),
            @ApiImplicitParam(name = "nameLike", dataType = "string", value = "Only return groups with a name like the given value. Use % as wildcard-character.", paramType = "query"),
            @ApiImplicitParam(name = "member", dataType = "string", value = "Only return groups which have a member with the given username.", paramType = "query"),
            @ApiImplicitParam(name = "potentialStarter", dataType = "string", value = "Only return groups which members are potential starters for a process-definition with the given id.", paramType = "query"),
            @ApiImplicitParam(name = "sort", dataType = "string", value = "Property to sort on, to be used together with the order.", allowableValues = "id,name,type", paramType = "query"),
    })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Indicates the requested groups were returned.")
    })
    @GetMapping(value = "/identity/groups", produces = "application/json")
    public DataResponse<GroupResponse> getGroups(@ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams) {
        GroupQuery query = identityService.createGroupQuery();

        if (allRequestParams.containsKey("id")) {
            query.groupId(allRequestParams.get("id"));
        }
        if (allRequestParams.containsKey("name")) {
            query.groupName(allRequestParams.get("name"));
        }
        if (allRequestParams.containsKey("nameLike")) {
            query.groupNameLike(allRequestParams.get("nameLike"));
        }
        if (allRequestParams.containsKey("type")) {
            query.groupType(allRequestParams.get("type"));
        }
        if (allRequestParams.containsKey("member")) {
            query.groupMember(allRequestParams.get("member"));
        }
        
        if (restApiInterceptor != null) {
            restApiInterceptor.accessGroupInfoWithQuery(query);
        }

        return paginateList(allRequestParams, query, "id", properties, restResponseFactory::createGroupResponseList);
    }
@Test
    @Deployment
    public void testGetGroups() throws Exception {
        List<Group> savedGroups = new ArrayList<>();
        try {
            Group group1 = identityService.newGroup("testgroup1");
            group1.setName("Test group");
            group1.setType("Test type");
            identityService.saveGroup(group1);
            savedGroups.add(group1);

            Group group2 = identityService.newGroup("testgroup2");
            group2.setName("Another group");
            group2.setType("Another type");
            identityService.saveGroup(group2);
            savedGroups.add(group2);

            Group group3 = identityService.createGroupQuery().groupId("admin").singleResult();
            assertThat(group3).isNotNull();
            
            Group group4 = identityService.createGroupQuery().groupId("sales").singleResult();
            assertThat(group4).isNotNull();

            // Test filter-less
            String url = RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_COLLECTION);
            assertResultsPresentInDataResponse(url, group1.getId(), group2.getId(), group3.getId(), group4.getId());

            // Test based on name
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_COLLECTION) + "?name=" + encode("Test group");
            assertResultsPresentInDataResponse(url, group1.getId());

            // Test based on name like
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_COLLECTION) + "?nameLike=" + encode("% group");
            assertResultsPresentInDataResponse(url, group2.getId(), group1.getId());

            // Test based on type
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_COLLECTION) + "?type=" + encode("Another type");
            assertResultsPresentInDataResponse(url, group2.getId());

            // Test based on group member
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_COLLECTION) + "?member=kermit";
            assertResultsPresentInDataResponse(url, group3.getId());

        } finally {

            // Delete groups after test passes or fails
            if (!savedGroups.isEmpty()) {
                for (Group group : savedGroups) {
                    identityService.deleteGroup(group.getId());
                }
            }
        }
    }