Group extends DSpaceObject implements DSpaceObjectLegacySupport { @Override public String getName() { return name; } protected  Group(); List<EPerson> getMembers(); List<Group> getMemberGroups(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int getType(); @Override String getName(); boolean isGroupsChanged(); void clearGroupsChanged(); @Override Integer getLegacyId(); List<WorkspaceItem> getSupervisedItems(); Boolean isPermanent(); @Transient
    static final String ANONYMOUS; @Transient
    static final String ADMIN; }
@Test public void findByName() throws SQLException { Group group = groupService.findByName(context, "topGroup"); assertThat("findByName 1", group, notNullValue()); assertThat("findByName 2", group.getName(), notNullValue()); assertThat("findByName 2", group.getName(), equalTo("topGroup")); }
@Test public void findAllNameSort() throws SQLException { List<Group> groups = groupService.findAll(context, null); assertThat("findAllNameSort 1", groups, notNullValue()); List<String> names = new ArrayList<>(); List<String> sortedNames = new ArrayList<>(); for (Group group : groups) { if (group.getName() == null) { continue; } names.add(group.getName()); sortedNames.add(group.getName()); } Collections.sort(sortedNames); assertThat("findAllNameSort compareLists", names, equalTo(sortedNames)); }
@Test public void isMemberContextGroupId() throws SQLException, AuthorizeException, EPersonDeletionException, IOException { EPerson ePerson = null; try { ePerson = createEPersonAndAddToGroup("isMemberContextGroupId@dspace.org", level2Group); assertTrue(groupService.isMember(context, ePerson, topGroup.getName())); assertTrue(groupService.isMember(context, ePerson, level1Group.getName())); assertTrue(groupService.isMember(context, ePerson, level2Group.getName())); } finally { if (ePerson != null) { context.turnOffAuthorisationSystem(); ePersonService.delete(context, ePerson); } } }