diff --git a/src/main/java/hs/fulda/de/ci/exam/project/FlightInstance.java b/src/main/java/hs/fulda/de/ci/exam/project/FlightInstance.java index 50672a7..2d30288 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/FlightInstance.java +++ b/src/main/java/hs/fulda/de/ci/exam/project/FlightInstance.java @@ -1,4 +1,27 @@ package hs.fulda.de.ci.exam.project; +import java.sql.Time; + public class FlightInstance { + Time departureTime; + String gate; + FlightStatus status; + + public FlightInstance(Time departureTime, String gate, FlightStatus status) { + this.departureTime = departureTime; + this.gate = gate; + this.status = status; + } + + public Time getDepartureTime() { + return departureTime; + } + + public String getGate() { + return gate; + } + + public FlightStatus getStatus() { + return status; + } } diff --git a/src/main/java/hs/fulda/de/ci/exam/project/FlightStatus.java b/src/main/java/hs/fulda/de/ci/exam/project/FlightStatus.java new file mode 100644 index 0000000..c265450 --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/FlightStatus.java @@ -0,0 +1,14 @@ +package hs.fulda.de.ci.exam.project; + +public enum FlightStatus { + Active, + Scheduled, + Delayed, + Departed, + Landed, + InAir, + Arrived, + Cancelled, + Diverted, + Unknown +} diff --git a/src/test/java/hs/fulda/de/ci/exam/project/FlightInstanceTest.java b/src/test/java/hs/fulda/de/ci/exam/project/FlightInstanceTest.java new file mode 100644 index 0000000..1f66143 --- /dev/null +++ b/src/test/java/hs/fulda/de/ci/exam/project/FlightInstanceTest.java @@ -0,0 +1,20 @@ +package hs.fulda.de.ci.exam.project; + +import org.junit.jupiter.api.Test; + +import java.sql.Time; + +import static hs.fulda.de.ci.exam.project.FlightStatus.InAir; +import static org.assertj.core.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.*; + +class FlightInstanceTest { + Time today = Time.valueOf("13:45:40"); + FlightInstance fInstance1 = new FlightInstance(today, "G15", InAir); + + @Test + void getDepartureTime(){ + assertThat(fInstance1.getDepartureTime()).describedAs("get departure time of flight isntance").isEqualTo(Time.valueOf("13:45:40")); + } + +} \ No newline at end of file diff --git a/src/test/java/hs/fulda/de/ci/exam/project/FlightTest.java b/src/test/java/hs/fulda/de/ci/exam/project/FlightTest.java index d6efd42..1a75ff3 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/FlightTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/FlightTest.java @@ -2,8 +2,10 @@ package hs.fulda.de.ci.exam.project; import org.junit.jupiter.api.Test; +import java.sql.Time; import java.util.HashSet; +import static hs.fulda.de.ci.exam.project.FlightStatus.InAir; import static org.assertj.core.api.Assertions.*; class FlightTest { @@ -18,8 +20,8 @@ class FlightTest { Flight flight1 = new Flight("1", airport_fr, airport1_ist, 140); Flight flight2 = new Flight("2", airport1_ist, airport_fr, 120); - - FlightInstance fInstance1 = new FlightInstance(); + Time today = Time.valueOf("13:45:40"); + FlightInstance fInstance1 = new FlightInstance(today, "G15", InAir); @Test void getInstances_no_instance_should_be_equal() { diff --git a/target/classes/hs/fulda/de/ci/exam/project/FlightInstance.class b/target/classes/hs/fulda/de/ci/exam/project/FlightInstance.class index 7f4aab6..9e46705 100644 Binary files a/target/classes/hs/fulda/de/ci/exam/project/FlightInstance.class and b/target/classes/hs/fulda/de/ci/exam/project/FlightInstance.class differ diff --git a/target/test-classes/hs/fulda/de/ci/exam/project/FlightTest.class b/target/test-classes/hs/fulda/de/ci/exam/project/FlightTest.class index a4b7c91..b90bf23 100644 Binary files a/target/test-classes/hs/fulda/de/ci/exam/project/FlightTest.class and b/target/test-classes/hs/fulda/de/ci/exam/project/FlightTest.class differ