1

changed role representation to enum

This commit is contained in:
Christoph
2020-03-06 20:58:57 +01:00
parent 17ae13c1e8
commit fb3a94cf04
4 changed files with 4 additions and 13 deletions

View File

@ -1,4 +0,0 @@
package mops.gruppen2.domain;
public class Admin extends Role {
}

View File

@ -1,4 +0,0 @@
package mops.gruppen2.domain;
public class Org extends Role {
}

View File

@ -1,5 +1,5 @@
package mops.gruppen2.domain;
public class Role {
public enum Role {
ORGA, ADMIN
}

View File

@ -67,18 +67,17 @@ class GroupTest {
void updateRoleForExistingUser() {
// Arrange
Group group = new Group();
Org org = new Org();
group.applyEvent(new CreateGroupEvent(1L, 1L, "1L", "gruppe1", "Eine Testgruppe"));
group.applyEvent(new AddUserEvent(1L, 1L, "5L", "Peter", "Pan", "123@mail.de"));
// Act
group.applyEvent(new UpdateRoleEvent(1L, 1L, "5L", org));
group.applyEvent(new UpdateRoleEvent(1L, 1L, "5L", Role.ORGA));
// Assert
assertThat(group.getRoles())
.containsOnlyKeys(group.getMembers().get(0))
.containsValue(org);
.containsValue(Role.ORGA);
}
}