1

Exception rework: clearer message + origin

Co-authored-by: [Mahgs] <maxoerter@gmx.de>
Co-authored-by: Christoph <tobi@urpost.de>
This commit is contained in:
Christoph
2020-03-18 18:49:40 +01:00
parent 2d8472bd4a
commit b1460abe48
20 changed files with 76 additions and 111 deletions

View File

@ -3,6 +3,7 @@ package mops.gruppen2.domain.event;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import mops.gruppen2.domain.Exceptions.NoValueException;
import mops.gruppen2.domain.Group;
/**
@ -12,7 +13,8 @@ import mops.gruppen2.domain.Group;
@AllArgsConstructor
@NoArgsConstructor
public class UpdateGroupDescriptionEvent extends Event {
String newGroupDescription;
private String newGroupDescription;
public UpdateGroupDescriptionEvent(Long group_id, String user_id, String newGroupDescription) {
super(group_id, user_id);
@ -21,6 +23,10 @@ public class UpdateGroupDescriptionEvent extends Event {
@Override
public void applyEvent(Group group) {
if (this.newGroupDescription.isEmpty()) {
throw new NoValueException(this.getClass().toString());
}
group.setDescription(this.newGroupDescription);
}
}