diff --git a/src/test/java/hs/fulda/de/ci/exam/project/AircraftTest.java b/src/test/java/hs/fulda/de/ci/exam/project/AircraftTest.java index 88be8c9..14468b8 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/AircraftTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/AircraftTest.java @@ -2,7 +2,10 @@ package hs.fulda.de.ci.exam.project; 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 { @Test @@ -27,4 +30,34 @@ public class AircraftTest { .describedAs("get the manifacturing year of aircraft") .isEqualTo(1990); } + + @Test + public void test_getFlightsEmptyList(){ + Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990); + HashSet 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 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); + } + + + }