AdministratorGeoStoreClient extends GeoStoreClient { public Long insert(User user) { String sid = getBaseWebResource("users").header("Content-Type", MediaType.TEXT_XML) .accept(MediaType.TEXT_PLAIN).post(String.class, user); return Long.parseLong(sid); }  User getUser(long id); User getUser(String name); User getUser(long id, Boolean includeAttributes); UserList getUsers(); UserList getUsers(Integer page, Integer entries); User getUserDetails(); Long insert(User user); void deleteUser(Long id); void update(Long id, User user); long insertUserGroup(UserGroup usergroup); void deleteUserGroup(long usergroupId); void assignUserGroup(long userId, long usergroupId); void deassignUserGroup(long userId, long usergroupId); RESTUserGroup getUserGroup(long usergroupId); UserGroupList getUserGroups(Integer page, Integer entries, boolean all); ShortResourceList updateSecurityRules(ShortResourceList resourcesToSet, Long groupId,
            boolean canRead, boolean canWrite); RESTUserGroup getUserGroup(String name);  }
@Test public void allGroupsOfAnUserTest(){ int grpTestUserNum = 5, grpUUserNum = 3; String usrTestName = "test"; String usrTestPasswd = "test"; User testUser = new User(); testUser.setName(usrTestName); testUser.setRole(Role.USER); testUser.setNewPassword(usrTestPasswd); Set<UserGroup> testUserGroups = createSomeGroups(grpTestUserNum, usrTestName); addSomeUserGroups(testUserGroups); testUser.setGroups(testUserGroups); geoStoreClient.insert(testUser); User u = new User(); u.setName("u"); u.setRole(Role.USER); Set<UserGroup> uGroups = createSomeGroups(grpUUserNum, "u"); addSomeUserGroups(uGroups); u.setGroups(uGroups); geoStoreClient.insert(u); GeoStoreClient userClient = createUserClient(usrTestName, usrTestPasswd); ExtGroupList result = userClient.searchUserGroup(0, 10, "*"); assertEquals(result.getCount(), grpTestUserNum); }