diff --git a/src/main/java/hs/fulda/de/ci/exam/project/EmailNotification.java b/src/main/java/hs/fulda/de/ci/exam/project/EmailNotification.java index 1e3352e..a72d30e 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/EmailNotification.java +++ b/src/main/java/hs/fulda/de/ci/exam/project/EmailNotification.java @@ -17,6 +17,7 @@ public class EmailNotification extends Notification { System.out.println("Email is sent to " + email); return true; } + System.out.println("Invalid Email Address"); return false; } diff --git a/src/test/java/hs/fulda/de/ci/exam/project/NotificationTest.java b/src/test/java/hs/fulda/de/ci/exam/project/NotificationTest.java index 39fe4d1..2c2fced 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/NotificationTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/NotificationTest.java @@ -3,7 +3,7 @@ package hs.fulda.de.ci.exam.project; import org.junit.Test; import static hs.fulda.de.ci.exam.project.ReservationStatus.Confirmed; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; public class NotificationTest { @Test @@ -13,6 +13,13 @@ public class NotificationTest { assertTrue(result); } + @Test + public void emailValidiationShouldReturnFalseForInValidEmail(){ + EmailNotification email = new EmailNotification("testgmail.com", "HelloWorld"); + boolean result = email.sendNotification(); + assertFalse(result); + } + @Test public void emailNotificationShouldBeSentWhenFlighReservationCompleted() { FlightReservation reservation = new FlightReservation();