|
@ -7,14 +7,14 @@ import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
|
public class NotificationTest { |
|
|
public class NotificationTest { |
|
|
@Test |
|
|
@Test |
|
|
public void emailValidiationShouldReturnTrueForValidEmail(){ |
|
|
|
|
|
|
|
|
public void emailValidiationShouldReturnTrueForValidEmail() { |
|
|
EmailNotification email = new EmailNotification("test@gmail.com", "HelloWorld"); |
|
|
EmailNotification email = new EmailNotification("test@gmail.com", "HelloWorld"); |
|
|
boolean result = email.sendNotification(); |
|
|
boolean result = email.sendNotification(); |
|
|
assertTrue(result); |
|
|
assertTrue(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
public void emailValidiationShouldReturnFalseForInValidEmail(){ |
|
|
|
|
|
|
|
|
public void emailValidiationShouldReturnFalseForInValidEmail() { |
|
|
EmailNotification email = new EmailNotification("testgmail.com", "HelloWorld"); |
|
|
EmailNotification email = new EmailNotification("testgmail.com", "HelloWorld"); |
|
|
boolean result = email.sendNotification(); |
|
|
boolean result = email.sendNotification(); |
|
|
assertFalse(result); |
|
|
assertFalse(result); |
|
@ -24,7 +24,15 @@ public class NotificationTest { |
|
|
public void emailNotificationShouldBeSentWhenFlighReservationCompleted() { |
|
|
public void emailNotificationShouldBeSentWhenFlighReservationCompleted() { |
|
|
FlightReservation reservation = new FlightReservation(); |
|
|
FlightReservation reservation = new FlightReservation(); |
|
|
reservation.setStatus(Confirmed); |
|
|
reservation.setStatus(Confirmed); |
|
|
boolean result = reservation.notifyUser("email", "test@gmail.com","Reservation is Confirmed!"); |
|
|
|
|
|
|
|
|
boolean result = reservation.notifyUser("email", "test@gmail.com", "Reservation is Confirmed!"); |
|
|
|
|
|
assertTrue(result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void smsNotificationShouldBeSentWhenSmsTypeIsChosen(){ |
|
|
|
|
|
FlightReservation reservation = new FlightReservation(); |
|
|
|
|
|
reservation.setStatus(Confirmed); |
|
|
|
|
|
boolean result = reservation.notifyUser("sms", "01788370107", "Reservation is successfull"); |
|
|
assertTrue(result); |
|
|
assertTrue(result); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |