Browse Source

refactor airlinetest

feature-pr-AirlineClass
Imron 3 years ago
parent
commit
9da2331c58
  1. 12
      src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java

12
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<Flight> 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<Flight> 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<Flight> flights = new HashSet<>();
flights.add(flight1);
airline.addFlight(flight1);

Loading…
Cancel
Save