diff --git a/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java b/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java index 6230300..4777567 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java @@ -11,9 +11,13 @@ import static org.mockito.Mockito.mock; @RunWith(MockitoJUnitRunner.class) public class AirlineTest { + + Airline airline = new Airline("Pegasus", "1234"); + Flight flight1 = mock(Flight.class); + HashSet flights = new HashSet<>(); + @Test void testConstructorSetsNameParameterCorrectly() { - Airline airline = new Airline("Pegasus", "1234"); assertThat(airline.getName()) .describedAs("name of airline") .isEqualTo("Pegasus"); @@ -21,7 +25,6 @@ public class AirlineTest { @Test void testConstructorSetsCodeParameterCorrectly() { - Airline airline = new Airline("Pegasus", "1234"); assertThat(airline.getCode()) .describedAs("code of airline") .isEqualTo("1234"); @@ -29,8 +32,6 @@ public class AirlineTest { @Test void getFlightsReturnsEmptyListOfFlights() { - Airline airline = new Airline("Pegasus", "1234"); - HashSet flights = new HashSet<>(); assertThat(airline.getFlights()) .describedAs("flights of airline") .isEqualTo(flights); @@ -38,9 +39,6 @@ public class AirlineTest { @Test void addFlightAddsFlightToListOfFlights() { - Airline airline = new Airline("Pegasus", "1234"); - Flight flight1 = mock(Flight.class); - HashSet flights = new HashSet<>(); flights.add(flight1); airline.addFlight(flight1);