@Test
public void removeMemberEPerson() throws SQLException, AuthorizeException, EPersonDeletionException, IOException {

    EPerson ePerson = null;
    try {
        // Test normal behavior, add user to group & remove
        ePerson = createEPersonAndAddToGroup("removeMemberEPerson@dspace.org", level2Group);
        context.setCurrentUser(ePerson);
        assertTrue(groupService.isMember(context, topGroup));
        assertTrue(groupService.isMember(context, level1Group));
        assertTrue(groupService.isMember(context, level2Group));
        groupService.removeMember(context, level2Group, ePerson);
        assertFalse(groupService.isMember(context, topGroup));
        assertFalse(groupService.isMember(context, level1Group));
        assertFalse(groupService.isMember(context, level2Group));
        //Test non recursive removal, if not a member do not add
        groupService.addMember(context, level2Group, ePerson);
        assertTrue(groupService.isMember(context, topGroup));
        assertTrue(groupService.isMember(context, level1Group));
        assertTrue(groupService.isMember(context, level2Group));
        groupService.removeMember(context, topGroup, ePerson);
        assertTrue(groupService.isMember(context, topGroup));
        assertTrue(groupService.isMember(context, level1Group));
        assertTrue(groupService.isMember(context, level2Group));
    } finally {
        if(ePerson != null)
        {
            context.turnOffAuthorisationSystem();
            ePersonService.delete(context, ePerson);
        }
    }
}