Browse Source

aircraft get flights

feature-pr-AircraftClass
Imron 3 years ago
parent
commit
e7f4ecbfcc
  1. 35
      src/test/java/hs/fulda/de/ci/exam/project/AircraftTest.java

35
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<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);
}
}
Loading…
Cancel
Save