|
@ -2,7 +2,10 @@ package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.*; |
|
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
|
|
|
|
|
public class AircraftTest { |
|
|
public class AircraftTest { |
|
|
@Test |
|
|
@Test |
|
@ -27,4 +30,34 @@ public class AircraftTest { |
|
|
.describedAs("get the manifacturing year of aircraft") |
|
|
.describedAs("get the manifacturing year of aircraft") |
|
|
.isEqualTo(1990); |
|
|
.isEqualTo(1990); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void test_getFlightsEmptyList(){ |
|
|
|
|
|
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990); |
|
|
|
|
|
HashSet<Flight> flights = new HashSet<>(); |
|
|
|
|
|
assertThat(testAircraft.getFlights()) |
|
|
|
|
|
.describedAs("get the manifacturing year of aircraft") |
|
|
|
|
|
.isEqualTo(flights); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void test_getFlights_wiht_2_flights(){ |
|
|
|
|
|
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990); |
|
|
|
|
|
HashSet<Flight> flights = new HashSet<>(); |
|
|
|
|
|
Flight flight1 = mock(Flight.class); |
|
|
|
|
|
Flight flight2 = mock(Flight.class); |
|
|
|
|
|
|
|
|
|
|
|
flights.add(flight1); |
|
|
|
|
|
flights.add(flight2); |
|
|
|
|
|
|
|
|
|
|
|
testAircraft.addFlight(flight1); |
|
|
|
|
|
testAircraft.addFlight(flight2); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(testAircraft.getFlights()) |
|
|
|
|
|
.describedAs("get flights of aircraft") |
|
|
|
|
|
.isEqualTo(flights); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |