Browse Source

email validation

feature-pr-notification
Imron 3 years ago
parent
commit
0801e2e8aa
  1. 1
      src/main/java/hs/fulda/de/ci/exam/project/EmailNotification.java
  2. 9
      src/test/java/hs/fulda/de/ci/exam/project/NotificationTest.java

1
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;
}

9
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();

Loading…
Cancel
Save