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()));
|
||||
|
@ -77,38 +77,6 @@ class EventServiceTest {
|
||||
assertThat(dto.getEvent_type()).isEqualTo("CreateGroupEvent");
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
void getNewEvents_createGroupEvents() {
|
||||
eventService.saveAll(createPrivateGroupEvents(10));
|
||||
|
||||
assertThat(eventService.getNewEvents(0L)).hasSize(10);
|
||||
assertThat(eventService.getNewEvents(5L)).hasSize(5);
|
||||
assertThat(eventService.getNewEvents(10L)).isEmpty();
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
void getNewEvents_mixedEvents() {
|
||||
eventService.saveAll(createPrivateGroupEvent(uuidFromInt(0)),
|
||||
updateGroupDescriptionEvent(uuidFromInt(0)),
|
||||
createPrivateGroupEvent(uuidFromInt(1)),
|
||||
updateGroupDescriptionEvent(uuidFromInt(1)));
|
||||
|
||||
assertThat(eventService.getNewEvents(0L)).hasSize(4);
|
||||
assertThat(eventService.getNewEvents(1L)).hasSize(4);
|
||||
assertThat(eventService.getNewEvents(2L)).hasSize(2);
|
||||
assertThat(eventService.getNewEvents(3L)).hasSize(2);
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
void getMaxEvent_id() {
|
||||
eventService.saveAll(createPrivateGroupEvents(10));
|
||||
|
||||
assertThat(eventService.getMaxEvent_id()).isEqualTo(10);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getEventsOfGroup() {
|
||||
eventService.saveAll(addUserEvents(10, uuidFromInt(0)),
|
||||
|
Reference in New Issue
Block a user