fix tests
This commit is contained in:
@ -5,7 +5,6 @@ import mops.gruppen2.domain.Account;
|
|||||||
import mops.gruppen2.domain.Group;
|
import mops.gruppen2.domain.Group;
|
||||||
import mops.gruppen2.domain.GroupType;
|
import mops.gruppen2.domain.GroupType;
|
||||||
import mops.gruppen2.domain.Role;
|
import mops.gruppen2.domain.Role;
|
||||||
import mops.gruppen2.domain.Visibility;
|
|
||||||
import mops.gruppen2.domain.event.AddUserEvent;
|
import mops.gruppen2.domain.event.AddUserEvent;
|
||||||
import mops.gruppen2.domain.event.CreateGroupEvent;
|
import mops.gruppen2.domain.event.CreateGroupEvent;
|
||||||
import mops.gruppen2.domain.event.DeleteGroupEvent;
|
import mops.gruppen2.domain.event.DeleteGroupEvent;
|
||||||
@ -152,7 +151,7 @@ public class TestBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Event createPrivateGroupEvent(UUID groupId) {
|
public static Event createPrivateGroupEvent(UUID groupId) {
|
||||||
return createGroupEvent(groupId, Visibility.PRIVATE);
|
return createGroupEvent(groupId, GroupType.PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Event createPrivateGroupEvent() {
|
public static Event createPrivateGroupEvent() {
|
||||||
@ -160,20 +159,19 @@ public class TestBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Event createPublicGroupEvent(UUID groupId) {
|
public static Event createPublicGroupEvent(UUID groupId) {
|
||||||
return createGroupEvent(groupId, Visibility.PUBLIC);
|
return createGroupEvent(groupId, GroupType.PUBLIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Event createPublicGroupEvent() {
|
public static Event createPublicGroupEvent() {
|
||||||
return createPublicGroupEvent(UUID.randomUUID());
|
return createPublicGroupEvent(UUID.randomUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Event createGroupEvent(UUID groupId, Visibility visibility) {
|
public static Event createGroupEvent(UUID groupId, GroupType type) {
|
||||||
return new CreateGroupEvent(
|
return new CreateGroupEvent(
|
||||||
groupId,
|
groupId,
|
||||||
faker.random().hex(),
|
faker.random().hex(),
|
||||||
null,
|
null,
|
||||||
GroupType.SIMPLE,
|
type
|
||||||
visibility
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +184,7 @@ public class TestBuilder {
|
|||||||
groupId,
|
groupId,
|
||||||
faker.random().hex(),
|
faker.random().hex(),
|
||||||
null,
|
null,
|
||||||
GroupType.LECTURE,
|
GroupType.LECTURE
|
||||||
Visibility.PUBLIC
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package mops.gruppen2.domain.event;
|
|||||||
import mops.gruppen2.TestBuilder;
|
import mops.gruppen2.TestBuilder;
|
||||||
import mops.gruppen2.domain.Group;
|
import mops.gruppen2.domain.Group;
|
||||||
import mops.gruppen2.domain.GroupType;
|
import mops.gruppen2.domain.GroupType;
|
||||||
import mops.gruppen2.domain.Visibility;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static mops.gruppen2.TestBuilder.uuidMock;
|
import static mops.gruppen2.TestBuilder.uuidMock;
|
||||||
@ -16,15 +15,13 @@ class DeleteGroupEventTest {
|
|||||||
Event createEvent = new CreateGroupEvent(uuidMock(0),
|
Event createEvent = new CreateGroupEvent(uuidMock(0),
|
||||||
"A",
|
"A",
|
||||||
uuidMock(1),
|
uuidMock(1),
|
||||||
GroupType.SIMPLE,
|
GroupType.PUBLIC);
|
||||||
Visibility.PUBLIC);
|
|
||||||
Event deleteEvent = new DeleteGroupEvent(uuidMock(0), "A");
|
Event deleteEvent = new DeleteGroupEvent(uuidMock(0), "A");
|
||||||
|
|
||||||
Group group = TestBuilder.apply(createEvent, deleteEvent);
|
Group group = TestBuilder.apply(createEvent, deleteEvent);
|
||||||
|
|
||||||
assertThat(group.getMembers()).isEmpty();
|
assertThat(group.getMembers()).isEmpty();
|
||||||
assertThat(group.getType()).isEqualTo(null);
|
assertThat(group.getType()).isEqualTo(null);
|
||||||
assertThat(group.getVisibility()).isEqualTo(null);
|
|
||||||
assertThat(group.getUserLimit()).isEqualTo(0);
|
assertThat(group.getUserLimit()).isEqualTo(0);
|
||||||
assertThat(group.getId()).isEqualTo(uuidMock(0));
|
assertThat(group.getId()).isEqualTo(uuidMock(0));
|
||||||
assertThat(group.getParent()).isEqualTo(null);
|
assertThat(group.getParent()).isEqualTo(null);
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package mops.gruppen2.service;
|
|||||||
import mops.gruppen2.Gruppen2Application;
|
import mops.gruppen2.Gruppen2Application;
|
||||||
import mops.gruppen2.TestBuilder;
|
import mops.gruppen2.TestBuilder;
|
||||||
import mops.gruppen2.domain.Group;
|
import mops.gruppen2.domain.Group;
|
||||||
|
import mops.gruppen2.domain.GroupType;
|
||||||
import mops.gruppen2.domain.User;
|
import mops.gruppen2.domain.User;
|
||||||
import mops.gruppen2.domain.Visibility;
|
|
||||||
import mops.gruppen2.domain.event.Event;
|
import mops.gruppen2.domain.event.Event;
|
||||||
import mops.gruppen2.repository.EventRepository;
|
import mops.gruppen2.repository.EventRepository;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@ -85,7 +85,7 @@ class GroupServiceTest {
|
|||||||
|
|
||||||
assertThat(groups).hasSize(1);
|
assertThat(groups).hasSize(1);
|
||||||
assertThat(groups.get(0).getMembers()).hasSize(5);
|
assertThat(groups.get(0).getMembers()).hasSize(5);
|
||||||
assertThat(groups.get(0).getVisibility()).isEqualTo(Visibility.PRIVATE);
|
assertThat(groups.get(0).getType()).isEqualTo(GroupType.PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: ProjectionServiceTest
|
//TODO: ProjectionServiceTest
|
||||||
|
|||||||
Reference in New Issue
Block a user