diff options
author | Dominic Rogetzer <e1627756@student.tuwien.ac.at> | 2018-05-01 16:14:04 +0200 |
---|---|---|
committer | Dominic Rogetzer <e01627756@student.tuwien.ac.at> | 2018-05-03 22:48:30 +0200 |
commit | 795f86fb257c6d5099886390b4dfe9971f5a6371 (patch) | |
tree | 42e55c9a5e05efbf83c83c8c9ad1a5abaaf99ee0 /src | |
parent | 715a289ec50e38a6fb0b623720ac39b5398a849a (diff) | |
download | sepm-groupproject-795f86fb257c6d5099886390b4dfe9971f5a6371.tar.gz sepm-groupproject-795f86fb257c6d5099886390b4dfe9971f5a6371.tar.xz sepm-groupproject-795f86fb257c6d5099886390b4dfe9971f5a6371.zip |
create EmployeeValidator
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/EmployeeValidator.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/EmployeeValidator.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/EmployeeValidator.java new file mode 100644 index 0000000..d7fa9aa --- /dev/null +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/EmployeeValidator.java @@ -0,0 +1,23 @@ +package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto; + +import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidEmployeeException; + +public class EmployeeValidator { + + public static boolean validate(Employee employee) throws InvalidEmployeeException { + + if (employee.name() == null || employee.name().trim().length() == 0) { + throw new InvalidEmployeeException("name not set"); + } + + if (employee.birthday() == null) { + throw new InvalidEmployeeException("birthday not set"); + } + + if (employee.educationLevel() == null) { + throw new InvalidEmployeeException("educationLevel not set"); + } + + return true; + } +} |