changed role representation to enum
This commit is contained in:
@ -1,4 +0,0 @@
|
|||||||
package mops.gruppen2.domain;
|
|
||||||
|
|
||||||
public class Admin extends Role {
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
package mops.gruppen2.domain;
|
|
||||||
|
|
||||||
public class Org extends Role {
|
|
||||||
}
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
package mops.gruppen2.domain;
|
package mops.gruppen2.domain;
|
||||||
|
|
||||||
public class Role {
|
public enum Role {
|
||||||
|
ORGA, ADMIN
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,18 +67,17 @@ class GroupTest {
|
|||||||
void updateRoleForExistingUser() {
|
void updateRoleForExistingUser() {
|
||||||
// Arrange
|
// Arrange
|
||||||
Group group = new Group();
|
Group group = new Group();
|
||||||
Org org = new Org();
|
|
||||||
|
|
||||||
group.applyEvent(new CreateGroupEvent(1L, 1L, "1L", "gruppe1", "Eine Testgruppe"));
|
group.applyEvent(new CreateGroupEvent(1L, 1L, "1L", "gruppe1", "Eine Testgruppe"));
|
||||||
group.applyEvent(new AddUserEvent(1L, 1L, "5L", "Peter", "Pan", "123@mail.de"));
|
group.applyEvent(new AddUserEvent(1L, 1L, "5L", "Peter", "Pan", "123@mail.de"));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
group.applyEvent(new UpdateRoleEvent(1L, 1L, "5L", org));
|
group.applyEvent(new UpdateRoleEvent(1L, 1L, "5L", Role.ORGA));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
assertThat(group.getRoles())
|
assertThat(group.getRoles())
|
||||||
.containsOnlyKeys(group.getMembers().get(0))
|
.containsOnlyKeys(group.getMembers().get(0))
|
||||||
.containsValue(org);
|
.containsValue(Role.ORGA);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user