From e7f4ecbfcc16358e503a052aaa6debc20d1dd86b Mon Sep 17 00:00:00 2001 From: Imron Date: Mon, 31 Jan 2022 22:01:35 +0100 Subject: [PATCH] aircraft get flights --- .../de/ci/exam/project/AircraftTest.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) 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); + } + + + }