|
@ -1,9 +1,13 @@ |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Assert; |
|
|
|
|
|
import org.junit.jupiter.api.DisplayName; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.extension.ExtendWith; |
|
|
import org.junit.jupiter.api.extension.ExtendWith; |
|
|
import org.mockito.InjectMocks; |
|
|
import org.mockito.InjectMocks; |
|
|
import org.mockito.Mock; |
|
|
import org.mockito.Mock; |
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertThrows; |
|
|
import static org.mockito.Mockito.*; |
|
|
import static org.mockito.Mockito.*; |
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
@ -46,4 +50,16 @@ public class ItineraryTest { |
|
|
assertEquals(true, actualWithCheck, "The Payment method is successfully chosen"); |
|
|
assertEquals(true, actualWithCheck, "The Payment method is successfully chosen"); |
|
|
assertEquals(false, actualEmpty, "The Payment method is wrong"); |
|
|
assertEquals(false, actualEmpty, "The Payment method is wrong"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
@DisplayName("Should Not Make Reservation when Passenger name is null") |
|
|
|
|
|
public void shouldThrowRuntimeExceptionWhenNameIsNull(){ |
|
|
|
|
|
String msg = null; |
|
|
|
|
|
try { |
|
|
|
|
|
item1.makeReservation(new Passenger("", "Ab", new Date())); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
msg = e.getMessage(); |
|
|
|
|
|
} |
|
|
|
|
|
assertEquals(msg, "Name cannot be null or empty"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |