|
@ -8,45 +8,42 @@ import static org.assertj.core.api.Assertions.assertThat; |
|
|
import static org.mockito.Mockito.mock; |
|
|
import static org.mockito.Mockito.mock; |
|
|
|
|
|
|
|
|
public class AircraftTest { |
|
|
public class AircraftTest { |
|
|
@Test |
|
|
|
|
|
public void testClassAircraftConstructorName(){ |
|
|
|
|
|
|
|
|
|
|
|
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990); |
|
|
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990); |
|
|
|
|
|
HashSet<Flight> flights = new HashSet<>(); |
|
|
|
|
|
Flight flight1 = mock(Flight.class); |
|
|
|
|
|
Flight flight2 = mock(Flight.class); |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testClassAircraftConstructorName() { |
|
|
assertThat(testAircraft.getName()) |
|
|
assertThat(testAircraft.getName()) |
|
|
.describedAs("get the name of aircraft") |
|
|
.describedAs("get the name of aircraft") |
|
|
.isEqualTo("Airbus"); |
|
|
.isEqualTo("Airbus"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
public void testClassAircraftConstructorModel(){ |
|
|
|
|
|
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990); |
|
|
|
|
|
|
|
|
public void testClassAircraftConstructorModel() { |
|
|
assertThat(testAircraft.getModel()) |
|
|
assertThat(testAircraft.getModel()) |
|
|
.describedAs("get the model of aircraft") |
|
|
.describedAs("get the model of aircraft") |
|
|
.isEqualTo("Neo"); |
|
|
.isEqualTo("Neo"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
public void testClassAircraftConstructorManifacturingYear(){ |
|
|
|
|
|
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990); |
|
|
|
|
|
|
|
|
public void testClassAircraftConstructorManifacturingYear() { |
|
|
assertThat(testAircraft.getManYear()) |
|
|
assertThat(testAircraft.getManYear()) |
|
|
.describedAs("get the manifacturing year of aircraft") |
|
|
.describedAs("get the manifacturing year of aircraft") |
|
|
.isEqualTo(1990); |
|
|
.isEqualTo(1990); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
public void test_getFlightsEmptyList(){ |
|
|
|
|
|
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990); |
|
|
|
|
|
HashSet<Flight> flights = new HashSet<>(); |
|
|
|
|
|
|
|
|
public void test_getFlightsEmptyList() { |
|
|
assertThat(testAircraft.getFlights()) |
|
|
assertThat(testAircraft.getFlights()) |
|
|
.describedAs("get the manifacturing year of aircraft") |
|
|
.describedAs("get the manifacturing year of aircraft") |
|
|
.isEqualTo(flights); |
|
|
.isEqualTo(flights); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void test_getFlights_wiht_2_flights() { |
|
|
flights.add(flight1); |
|
|
flights.add(flight1); |
|
|
flights.add(flight2); |
|
|
flights.add(flight2); |
|
|
|
|
|
|
|
@ -59,5 +56,4 @@ public class AircraftTest { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |