1

Implementation of old EventExeptions

This commit is contained in:
Lukas Ettel
2020-03-17 15:57:26 +01:00
parent 1acfcc449f
commit 991bcf2aaa
8 changed files with 78 additions and 45 deletions

View File

@ -1,6 +1,8 @@
package mops.gruppen2.domain.event;
import lombok.*;
import mops.gruppen2.domain.Exceptions.EventException;
import mops.gruppen2.domain.Exceptions.UserNotFoundException;
import mops.gruppen2.domain.Group;
import mops.gruppen2.domain.User;
import mops.gruppen2.domain.Group;
@ -14,7 +16,7 @@ public class DeleteUserEvent extends Event {
super(group_id, user_id);
}
public void apply(Group group) {
public void apply(Group group) throws EventException {
for (User user : group.getMembers()) {
if (user.getUser_id().equals(this.user_id)) {
group.getMembers().remove(user);
@ -22,5 +24,6 @@ public class DeleteUserEvent extends Event {
return;
}
}
throw new UserNotFoundException("Der User existiert nicht");
}
}