Replace GroupService by GroupBuilder in a couple tests

This commit is contained in:
Antoine Snyers
2020-04-06 15:51:44 +02:00
parent b49c86ac49
commit e62d912b11

View File

@@ -1640,15 +1640,11 @@ public class GroupRestRepositoryIT extends AbstractControllerIntegrationTest {
@Test
public void deleteGroupTest() throws Exception {
GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
Group parentGroup = null;
try {
context.turnOffAuthorisationSystem();
parentGroup = groupService.create(context);
Group parentGroup = GroupBuilder.createGroup(context)
.withName("test group")
.build();
context.restoreAuthSystemState();
@@ -1665,25 +1661,15 @@ public class GroupRestRepositoryIT extends AbstractControllerIntegrationTest {
getClient(authToken).perform(
get("/api/eperson/groups/" + parentGroup.getID())
).andExpect(status().isNotFound());
} finally {
if (parentGroup != null) {
GroupBuilder.deleteGroup(parentGroup.getID());
}
}
}
@Test
public void deleteGroupUnauthorizedTest() throws Exception {
GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
Group parentGroup = null;
try {
context.turnOffAuthorisationSystem();
parentGroup = groupService.create(context);
Group parentGroup = GroupBuilder.createGroup(context)
.withName("test group")
.build();
context.restoreAuthSystemState();
@@ -1700,12 +1686,6 @@ public class GroupRestRepositoryIT extends AbstractControllerIntegrationTest {
getClient(authToken).perform(
get("/api/eperson/groups/" + parentGroup.getID())
).andExpect(status().isOk());
} finally {
if (parentGroup != null) {
GroupBuilder.deleteGroup(parentGroup.getID());
}
}
}
@Test