You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
package hs.fulda.de.ci.exam.project;
|
|
|
|
import org.junit.Test;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
import static org.mockito.Mockito.mock;
|
|
|
|
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
|
|
public void testClassAircraftConstructorName() {
|
|
assertThat(testAircraft.getName())
|
|
.describedAs("get the name of aircraft")
|
|
.isEqualTo("Airbus");
|
|
}
|
|
|
|
@Test
|
|
public void testClassAircraftConstructorModel() {
|
|
assertThat(testAircraft.getModel())
|
|
.describedAs("get the model of aircraft")
|
|
.isEqualTo("Neo");
|
|
}
|
|
|
|
@Test
|
|
public void testClassAircraftConstructorManifacturingYear() {
|
|
assertThat(testAircraft.getManYear())
|
|
.describedAs("get the manifacturing year of aircraft")
|
|
.isEqualTo(1990);
|
|
}
|
|
|
|
@Test
|
|
public void test_getFlightsEmptyList() {
|
|
assertThat(testAircraft.getFlights())
|
|
.describedAs("get the manifacturing year of aircraft")
|
|
.isEqualTo(flights);
|
|
}
|
|
|
|
@Test
|
|
public void test_getFlights_wiht_2_flights() {
|
|
flights.add(flight1);
|
|
flights.add(flight2);
|
|
|
|
testAircraft.addFlight(flight1);
|
|
testAircraft.addFlight(flight2);
|
|
|
|
assertThat(testAircraft.getFlights())
|
|
.describedAs("get flights of aircraft")
|
|
.isEqualTo(flights);
|
|
}
|
|
|
|
|
|
}
|