}
// Add
userGroup = new UserGroup(null, "testusergroup");
Authority authority = _userManager.getAuthority("testauthority");
if (authority == null) {
authority = new Authority("testauthority");
_userManager.addAuthority(authority);
}
userGroup.getAuthorities().add(authority);
User user = _userManager.getUser("testuser");
if (user == null) {
user = getTestUser();
_userManager.addUser(user);
}
_userManager.addUserGroup(userGroup);
// Update
Authority additionalAuthority = _userManager.getAuthority("additionalauthority");
if (additionalAuthority == null) {
additionalAuthority = new Authority("additionalauthority");
_userManager.addAuthority(additionalAuthority);
}
userGroup.getAuthorities().add(additionalAuthority);
_userManager.updateUserGroup(userGroup);
userGroup = _userManager.getUserGroup("testusergroup");