|
@ -1,9 +1,11 @@ |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
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.junit.jupiter.MockitoExtension; |
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
import java.util.LinkedList; |
|
|
import java.util.LinkedList; |
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.*; |
|
|
import static org.assertj.core.api.Assertions.*; |
|
@ -11,6 +13,7 @@ import static org.assertj.core.api.Assertions.*; |
|
|
@ExtendWith(MockitoExtension.class) |
|
|
@ExtendWith(MockitoExtension.class) |
|
|
public class AirportTest { |
|
|
public class AirportTest { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Address address_fr = new Address("Frankfurt str", "Frankfurt", "Hessen", "63023", "Germany"); |
|
|
Address address_fr = new Address("Frankfurt str", "Frankfurt", "Hessen", "63023", "Germany"); |
|
|
Airport airport_fr = new Airport("Fraport", address_fr, "1234"); |
|
|
Airport airport_fr = new Airport("Fraport", address_fr, "1234"); |
|
|
|
|
|
|
|
@ -39,11 +42,26 @@ public class AirportTest { |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void test_getFlights() { |
|
|
void test_getFlights() { |
|
|
LinkedList<Flight> flist = new LinkedList<>(); |
|
|
|
|
|
|
|
|
HashSet<Flight> flist = new HashSet<>(); |
|
|
|
|
|
flist.add(flight1); |
|
|
|
|
|
|
|
|
|
|
|
airport_fr.flights.add(flight1); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(airport_fr.getFlights()).describedAs("get all flights of the airport").isEqualTo(flist); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void test_getFlights_wiht_2_flights() { |
|
|
|
|
|
HashSet<Flight> flist = new HashSet<>(); |
|
|
flist.add(flight1); |
|
|
flist.add(flight1); |
|
|
|
|
|
flist.add(flight2); |
|
|
|
|
|
|
|
|
airport_fr.flights.add(flight1); |
|
|
airport_fr.flights.add(flight1); |
|
|
|
|
|
airport_fr.flights.add(flight1); |
|
|
|
|
|
airport_fr.flights.add(flight2); |
|
|
|
|
|
|
|
|
assertThat(airport_fr.getFlights()).describedAs("get all flights of the airport").isEqualTo(flist); |
|
|
assertThat(airport_fr.getFlights()).describedAs("get all flights of the airport").isEqualTo(flist); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |