|
@ -59,7 +59,7 @@ public class ItineraryTest { |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
@DisplayName("Should Not Make Reservation when Passenger name is null") |
|
|
@DisplayName("Should Not Make Reservation when Passenger name is null") |
|
|
public void shouldThrowRuntimeExceptionWhenNameIsNull(){ |
|
|
|
|
|
|
|
|
public void shouldThrowRuntimeExceptionWhenNameIsNull() { |
|
|
String msg = null; |
|
|
String msg = null; |
|
|
try { |
|
|
try { |
|
|
item1.makeReservation(new Passenger("", "Ab", new Date())); |
|
|
item1.makeReservation(new Passenger("", "Ab", new Date())); |
|
@ -72,7 +72,7 @@ public class ItineraryTest { |
|
|
@DisplayName("Should Not Make Reservation when Passenger passport number is invalid") |
|
|
@DisplayName("Should Not Make Reservation when Passenger passport number is invalid") |
|
|
@ParameterizedTest |
|
|
@ParameterizedTest |
|
|
@MethodSource("passportNumberList") |
|
|
@MethodSource("passportNumberList") |
|
|
public void shouldThrowRuntimeExceptionWhenPhoneNumberIsNull(String passportNumber){ |
|
|
|
|
|
|
|
|
public void shouldThrowRuntimeExceptionWhenPhoneNumberIsNull(String passportNumber) { |
|
|
String msg = null; |
|
|
String msg = null; |
|
|
try { |
|
|
try { |
|
|
item1.makeReservation(new Passenger("John", passportNumber, new Date())); |
|
|
item1.makeReservation(new Passenger("John", passportNumber, new Date())); |
|
@ -85,4 +85,12 @@ public class ItineraryTest { |
|
|
private static List<String> passportNumberList() { |
|
|
private static List<String> passportNumberList() { |
|
|
return Arrays.asList("A2", "000000", "AB231837%8"); |
|
|
return Arrays.asList("A2", "000000", "AB231837%8"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
@DisplayName("Should Not Make Reservation when Passenger Birthdate is null") |
|
|
|
|
|
public void shouldThrowRuntimeExceptionWhenDateIsNull() { |
|
|
|
|
|
assertThrows(RuntimeException.class, () -> { |
|
|
|
|
|
item1.makeReservation(new Passenger("John", "AB127389", null)); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |