Browse Source

get departure time of flight instance

feature-flight-instance
Imron 3 years ago
parent
commit
e49502ad01
  1. 23
      src/main/java/hs/fulda/de/ci/exam/project/FlightInstance.java
  2. 14
      src/main/java/hs/fulda/de/ci/exam/project/FlightStatus.java
  3. 20
      src/test/java/hs/fulda/de/ci/exam/project/FlightInstanceTest.java
  4. 6
      src/test/java/hs/fulda/de/ci/exam/project/FlightTest.java
  5. BIN
      target/classes/hs/fulda/de/ci/exam/project/FlightInstance.class
  6. BIN
      target/test-classes/hs/fulda/de/ci/exam/project/FlightTest.class

23
src/main/java/hs/fulda/de/ci/exam/project/FlightInstance.java

@ -1,4 +1,27 @@
package hs.fulda.de.ci.exam.project; package hs.fulda.de.ci.exam.project;
import java.sql.Time;
public class FlightInstance { 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;
}
} }

14
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
}

20
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"));
}
}

6
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 org.junit.jupiter.api.Test;
import java.sql.Time;
import java.util.HashSet; import java.util.HashSet;
import static hs.fulda.de.ci.exam.project.FlightStatus.InAir;
import static org.assertj.core.api.Assertions.*; import static org.assertj.core.api.Assertions.*;
class FlightTest { class FlightTest {
@ -18,8 +20,8 @@ class FlightTest {
Flight flight1 = new Flight("1", airport_fr, airport1_ist, 140); Flight flight1 = new Flight("1", airport_fr, airport1_ist, 140);
Flight flight2 = new Flight("2", airport1_ist, airport_fr, 120); 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 @Test
void getInstances_no_instance_should_be_equal() { void getInstances_no_instance_should_be_equal() {

BIN
target/classes/hs/fulda/de/ci/exam/project/FlightInstance.class

BIN
target/test-classes/hs/fulda/de/ci/exam/project/FlightTest.class

Loading…
Cancel
Save