Compare commits

...

5 Commits

  1. 33
      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. 41
      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

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

@ -1,4 +1,37 @@
package hs.fulda.de.ci.exam.project;
import java.sql.Time;
import static hs.fulda.de.ci.exam.project.FlightStatus.Cancelled;
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 this.departureTime;
}
public String getGate() {
return this.gate;
}
public FlightStatus getStatus() {
return this.status;
}
public void updateStatus(FlightStatus status) {
this.status = status;
}
public boolean cancel() {
return true;
}
}

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
}

41
src/test/java/hs/fulda/de/ci/exam/project/FlightInstanceTest.java

@ -0,0 +1,41 @@
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.*;
import static org.assertj.core.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"));
}
@Test
void getGate() {
assertThat(fInstance1.getGate()).describedAs("get gate number of flight isntance").isEqualTo("G15");
}
@Test
void getStatus() {
assertThat(fInstance1.getStatus()).describedAs("get status of flight isntance").isEqualTo(InAir);
}
@Test
void updateStatus() {
fInstance1.updateStatus(Arrived);
assertThat(fInstance1.getStatus()).describedAs("get status of flight isntance").isEqualTo(Arrived);
}
@Test
void cancel_FlightInstance() {
// TODO: 26.01.22 discuss
}
}

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 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() {

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