### Question:
UserGroupAOImpl extends IRODSGenericAO implements UserGroupAO { @Override public void removeUserGroup(final String userGroupName) throws JargonException { log.info("removeUserGroup()"); if (userGroupName == null || userGroupName.isEmpty()) { throw new IllegalArgumentException("null or empty user group name"); } if (userGroupName.contains("#")) { throw new IllegalArgumentException("cannot remove cross-zone group"); } log.info("userGroupName:{}", userGroupName); UserGroup userGroup = findByName(userGroupName); if (userGroup == null) { log.info("userGroup not found, treat as deleted"); return; } removeUserGroup(userGroup); } protected  UserGroupAOImpl(final IRODSSession irodsSession, final IRODSAccount irodsAccount); @Override void addUserGroup(final UserGroup userGroup); @Override void addUserGroupAsGroupAdmin(final UserGroup userGroup); @Override void removeUserGroup(final String userGroupName); @Override void removeUserGroup(final UserGroup userGroup); @Override UserGroup find(final String userGroupId); @Override List<UserGroup> findAll(); @Override UserGroup findByName(final String userGroupName); @Override List<User> listUserGroupMembers(final String userGroupName); @Override List<User> listUserGroupMembers(final String userGroupName, final String targetZone); @Override List<UserGroup> findUserGroups(final String userGroupName); @Override List<UserGroup> findUserGroupsForUserInZone(final String userName, final String targetZone); @Override List<UserGroup> findUserGroupsForUser(final String userName); @Override boolean isUserInGroup(final String userName, final String groupName); @Override void addUserToGroup(final String userGroupName, final String userName, final String zoneName); @Override void addUserToGroupAsGroupAdmin(final String userGroupName, final String userName, final String zoneName); @Override void removeUserFromGroup(final String userGroupName, final String userName, final String zoneName); @Override List<UserGroup> findUserGroups(String userGroupName, boolean caseInsensitive); @Override List<String> findUserGroupNames(String userGroupName, boolean caseInsensitive);  }### Answer:
@Test public final void testRemoveUserGroup() throws Exception { IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAdminAccountFromTestProperties(testingProperties); String testUserGroup = "testRemoveUserGroup"; IRODSAccessObjectFactory accessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory(); UserGroupAO userGroupAO = accessObjectFactory.getUserGroupAO(irodsAccount); UserGroup userGroup = new UserGroup(); userGroup.setUserGroupName(testUserGroup); userGroup.setZone(irodsAccount.getZone()); userGroupAO.removeUserGroup(userGroup); userGroupAO.addUserGroup(userGroup); userGroupAO.removeUserGroup(userGroup); UserGroup actual = userGroupAO.findByName(testUserGroup); Assert.assertNull("user group returned", actual); }
@Test public final void testRemoveUserGroupByNameThatDoesNotExist() throws Exception { IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAdminAccountFromTestProperties(testingProperties); String testUserGroup = "testRemoveUserGroupByNameThatDoesNotExist"; IRODSAccessObjectFactory accessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory(); UserGroupAO userGroupAO = accessObjectFactory.getUserGroupAO(irodsAccount); userGroupAO.removeUserGroup(testUserGroup); }