### Question:
UserGroupAOImpl extends IRODSGenericAO implements UserGroupAO { @Override public List<UserGroup> findUserGroups(final String userGroupName) throws JargonException { return findUserGroups(userGroupName, false); } 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 findUserGroups() throws Exception { IRODSProtocolManager irodsConnectionManager = IRODSSimpleProtocolManager.instance(); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); IRODSSession irodsSession = IRODSSession.instance(irodsConnectionManager); IRODSAccessObjectFactory accessObjectFactory = IRODSAccessObjectFactoryImpl.instance(irodsSession); UserGroupAO userGroupAO = accessObjectFactory.getUserGroupAO(irodsAccount); UserGroup userGroup = userGroupAO .findByName((String) testingProperties.get(TestingPropertiesHelper.IRODS_USER_GROUP_KEY)); Assert.assertNotNull("no user group returned", userGroup); List<UserGroup> userGroups = userGroupAO .findUserGroups(userGroup.getUserGroupName().substring(0, userGroup.getUserGroupName().length() - 2)); Assert.assertFalse("no user groups found", userGroups.isEmpty()); }
@Test public final void findUserGroupsCaseInsensitive() throws Exception { IRODSProtocolManager irodsConnectionManager = IRODSSimpleProtocolManager.instance(); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); IRODSSession irodsSession = IRODSSession.instance(irodsConnectionManager); IRODSAccessObjectFactory accessObjectFactory = IRODSAccessObjectFactoryImpl.instance(irodsSession); UserGroupAO userGroupAO = accessObjectFactory.getUserGroupAO(irodsAccount); List<UserGroup> userGroups = userGroupAO.findUserGroups( ((String) testingProperties.get(TestingPropertiesHelper.IRODS_USER_GROUP_KEY)).toUpperCase(), true); Assert.assertFalse("no user groups found", userGroups.isEmpty()); }
@Test public final void findUserGroupsEmptyTerm() throws Exception { IRODSProtocolManager irodsConnectionManager = IRODSSimpleProtocolManager.instance(); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); IRODSSession irodsSession = IRODSSession.instance(irodsConnectionManager); IRODSAccessObjectFactory accessObjectFactory = IRODSAccessObjectFactoryImpl.instance(irodsSession); UserGroupAO userGroupAO = accessObjectFactory.getUserGroupAO(irodsAccount); List<UserGroup> userGroups = userGroupAO.findUserGroups(""); Assert.assertFalse("no user groups found", userGroups.isEmpty()); }