From e49502ad013ad8b46bc0ab8292164ac2bccb5119 Mon Sep 17 00:00:00 2001 From: Imron Date: Wed, 26 Jan 2022 14:04:22 +0100 Subject: [PATCH] get departure time of flight instance --- .../de/ci/exam/project/FlightInstance.java | 23 ++++++++++++++++++ .../de/ci/exam/project/FlightStatus.java | 14 +++++++++++ .../ci/exam/project/FlightInstanceTest.java | 20 +++++++++++++++ .../fulda/de/ci/exam/project/FlightTest.java | 6 +++-- .../de/ci/exam/project/FlightInstance.class | Bin 323 -> 949 bytes .../fulda/de/ci/exam/project/FlightTest.class | Bin 4071 -> 4432 bytes 6 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 src/main/java/hs/fulda/de/ci/exam/project/FlightStatus.java create mode 100644 src/test/java/hs/fulda/de/ci/exam/project/FlightInstanceTest.java 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 7f4aab648cd30bd34e1d1f4d560f86e89e68f38f..9e46705bb2bb68b8e841ca00492defa2a042e7e9 100644 GIT binary patch literal 949 zcmb7CO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