diff --git a/src/main/java/hs/fulda/de/ci/exam/project/FrontDeskOfficer.java b/src/main/java/hs/fulda/de/ci/exam/project/FrontDeskOfficer.java index df0bd9a..941be16 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/FrontDeskOfficer.java +++ b/src/main/java/hs/fulda/de/ci/exam/project/FrontDeskOfficer.java @@ -37,5 +37,6 @@ public class FrontDeskOfficer extends Person{ public void validateItinerary(Itinerary itinerary){ itinerary.validateStartAirport(); itinerary.validateFinalAirport(); + itinerary.validateCreationDate(); } } diff --git a/src/main/java/hs/fulda/de/ci/exam/project/Itinerary.java b/src/main/java/hs/fulda/de/ci/exam/project/Itinerary.java index 7663290..00f9b5a 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/Itinerary.java +++ b/src/main/java/hs/fulda/de/ci/exam/project/Itinerary.java @@ -82,5 +82,9 @@ public class Itinerary { if(this.final_airport.getName().isBlank()) throw new RuntimeException(("Destination Airport Cannot be null or empty")); } + public void validateCreationDate() { + if(this.creationDate.equals(null)) + throw new RuntimeException(("Creation Date should not be null or empty")); + } } diff --git a/src/test/java/hs/fulda/de/ci/exam/project/FrontDeskOfficerTest.java b/src/test/java/hs/fulda/de/ci/exam/project/FrontDeskOfficerTest.java index e4e48f4..4488bd3 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/FrontDeskOfficerTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/FrontDeskOfficerTest.java @@ -36,7 +36,7 @@ public class FrontDeskOfficerTest { @DisplayName("Should Not Create Itinerary when Destination Airport is null") public void shouldThrowRuntimeExceptionWhenFinalAirportIsNull(){ assertThrows(RuntimeException.class, () -> { - frontDeskOfficer.createItinerary(airport_fr, null, new Date()); + frontDeskOfficer.createItinerary(airport_fr, airport_be, null); }); } }