|
@ -0,0 +1,49 @@ |
|
|
|
|
|
package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
import org.junit.jupiter.api.extension.ExtendWith; |
|
|
|
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.LinkedList; |
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.*; |
|
|
|
|
|
|
|
|
|
|
|
@ExtendWith(MockitoExtension.class) |
|
|
|
|
|
public class AirportTest { |
|
|
|
|
|
|
|
|
|
|
|
Address address_fr = new Address("Frankfurt str", "Frankfurt", "Hessen", "63023", "Germany"); |
|
|
|
|
|
Airport airport_fr = new Airport("Fraport", address_fr, "1234"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Address address1_ist = new Address("Istanbul str", "Istanbul", "Fatih", "9019", "Turkey"); |
|
|
|
|
|
Airport airport1_ist = new Airport("Istanbul", address1_ist, "5678"); |
|
|
|
|
|
|
|
|
|
|
|
Flight flight1 = new Flight("1", airport_fr, airport1_ist, 140); |
|
|
|
|
|
Flight flight2 = new Flight("2", airport1_ist, airport_fr, 120); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void test_getName() { |
|
|
|
|
|
assertThat(airport_fr.getName()).describedAs("get airport name").isEqualTo("Fraport"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void test_getCode() { |
|
|
|
|
|
assertThat(airport_fr.getCode()).describedAs("get airport code").isEqualTo("1234"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void test_getAddress() { |
|
|
|
|
|
assertThat(airport_fr.getAddress()).describedAs("get address of airport").isEqualTo(address_fr); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void test_getFlights() { |
|
|
|
|
|
LinkedList<Flight> flist = new LinkedList<>(); |
|
|
|
|
|
flist.add(flight1); |
|
|
|
|
|
|
|
|
|
|
|
airport_fr.flights.add(flight1); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(airport_fr.getFlights()).describedAs("get all flights of the airport").isEqualTo(flist); |
|
|
|
|
|
} |
|
|
|
|
|
} |