Browse Source

aircraft refactor

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

18
src/test/java/hs/fulda/de/ci/exam/project/AircraftTest.java

@ -8,9 +8,14 @@ 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 {
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990);
HashSet<Flight> flights = new HashSet<>();
Flight flight1 = mock(Flight.class);
Flight flight2 = mock(Flight.class);
@Test @Test
public void testClassAircraftConstructorName() { public void testClassAircraftConstructorName() {
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990);
assertThat(testAircraft.getName()) assertThat(testAircraft.getName())
.describedAs("get the name of aircraft") .describedAs("get the name of aircraft")
.isEqualTo("Airbus"); .isEqualTo("Airbus");
@ -18,14 +23,13 @@ public class AircraftTest {
@Test @Test
public void testClassAircraftConstructorModel() { public void testClassAircraftConstructorModel() {
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990);
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() { public void testClassAircraftConstructorManifacturingYear() {
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990);
assertThat(testAircraft.getManYear()) assertThat(testAircraft.getManYear())
.describedAs("get the manifacturing year of aircraft") .describedAs("get the manifacturing year of aircraft")
.isEqualTo(1990); .isEqualTo(1990);
@ -33,8 +37,6 @@ public class AircraftTest {
@Test @Test
public void test_getFlightsEmptyList() { public void test_getFlightsEmptyList() {
Aircraft testAircraft = new Aircraft("Airbus", "Neo", 1990);
HashSet<Flight> flights = new HashSet<>();
assertThat(testAircraft.getFlights()) assertThat(testAircraft.getFlights())
.describedAs("get the manifacturing year of aircraft") .describedAs("get the manifacturing year of aircraft")
.isEqualTo(flights); .isEqualTo(flights);
@ -42,11 +44,6 @@ public class AircraftTest {
@Test @Test
public void test_getFlights_wiht_2_flights() { 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(flight1);
flights.add(flight2); flights.add(flight2);
@ -59,5 +56,4 @@ public class AircraftTest {
} }
} }
Loading…
Cancel
Save