You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.8 KiB
56 lines
1.8 KiB
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.HashSet;
|
|
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() {
|
|
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(flight2);
|
|
airport_fr.flights.add(flight1);
|
|
airport_fr.flights.add(flight2);
|
|
assertThat(airport_fr.getFlights()).describedAs("get all flights of the airport").isEqualTo(flist);
|
|
}
|
|
}
|