|
|
@ -7,14 +7,14 @@ import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
public class NotificationTest { |
|
|
|
@Test |
|
|
|
public void emailValidiationShouldReturnTrueForValidEmail(){ |
|
|
|
public void emailValidiationShouldReturnTrueForValidEmail() { |
|
|
|
EmailNotification email = new EmailNotification("test@gmail.com", "HelloWorld"); |
|
|
|
boolean result = email.sendNotification(); |
|
|
|
assertTrue(result); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void emailValidiationShouldReturnFalseForInValidEmail(){ |
|
|
|
public void emailValidiationShouldReturnFalseForInValidEmail() { |
|
|
|
EmailNotification email = new EmailNotification("testgmail.com", "HelloWorld"); |
|
|
|
boolean result = email.sendNotification(); |
|
|
|
assertFalse(result); |
|
|
@ -24,7 +24,15 @@ public class NotificationTest { |
|
|
|
public void emailNotificationShouldBeSentWhenFlighReservationCompleted() { |
|
|
|
FlightReservation reservation = new FlightReservation(); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |