Fix tests and checkstyle
Co-Authored-By: andibuls <andibuls@users.noreply.github.com> Co-Authored-By: Lukas Ettel <lukasettel@users.noreply.github.com> Co-Authored-By: Talha Caliskan <killerber4t@users.noreply.github.com>
This commit is contained in:
@ -23,14 +23,19 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = Gruppen2Application.class)
|
||||
@Transactional
|
||||
@Rollback
|
||||
class ControllerServiceTest {
|
||||
Account account, account2, account3;
|
||||
Account account;
|
||||
Account account2;
|
||||
Account account3;
|
||||
ControllerService controllerService;
|
||||
EventService eventService;
|
||||
UserService userService;
|
||||
@ -277,8 +282,8 @@ class ControllerServiceTest {
|
||||
controllerService.createGroup(account, "test", "hi", null, null, true, null, null);
|
||||
List<Group> groups = userService.getUserGroups(new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail()));
|
||||
controllerService.addUser(account2, groups.get(0).getId());
|
||||
controllerService.changeRoleIfLastAdmin(account, groups.get(0));
|
||||
User user = new User(account.getName(), "", "", "");
|
||||
groups = userService.getUserGroups(new User(account2.getName(), account2.getGivenname(), account2.getFamilyname(), account2.getEmail()));
|
||||
controllerService.deleteUser(account, user, groups.get(0));
|
||||
groups = userService.getUserGroups(new User(account2.getName(), account2.getGivenname(), account2.getFamilyname(), account2.getEmail()));
|
||||
assertEquals(Role.ADMIN, groups.get(0).getRoles().get(account2.getName()));
|
||||
@ -306,6 +311,7 @@ class ControllerServiceTest {
|
||||
controllerService.addUser(account2, groups.get(0).getId());
|
||||
controllerService.addUser(account3, groups.get(0).getId());
|
||||
User user = new User(account.getName(), "", "", "");
|
||||
groups = userService.getUserGroups(new User(account2.getName(), account2.getGivenname(), account2.getFamilyname(), account2.getEmail()));
|
||||
controllerService.deleteUser(account, user, groups.get(0));
|
||||
groups = userService.getUserGroups(new User(account2.getName(), account2.getGivenname(), account2.getFamilyname(), account2.getEmail()));
|
||||
assertEquals(Role.ADMIN, groups.get(0).getRoles().get(account2.getName()));
|
||||
|
||||
Reference in New Issue
Block a user