Browse Source

Merge commit 'd2789b3e6599599f6722df5fbcdbe0d270df9fc9' into HEAD

feature-pr-FrontDeskOfficer
JenkinsSonaImron 3 years ago
parent
commit
ada29fe1a2
  1. 20
      src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java
  2. 40
      src/main/java/hs/fulda/de/ci/exam/project/Seat.java
  3. 5
      src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java
  4. 5
      src/main/java/hs/fulda/de/ci/exam/project/SeatType.java
  5. 29
      src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java
  6. BIN
      target/classes/hs/fulda/de/ci/exam/project/Itinerary.class
  7. BIN
      target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class

20
src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java

@ -0,0 +1,20 @@
package hs.fulda.de.ci.exam.project;
public class FlightSeat extends Seat {
private String reservationNumer;
private double fare;
public FlightSeat(double fare, String reservationNumer) {
super();
this.fare = fare;
this.reservationNumer = reservationNumer;
}
public double getFare() {
return this.fare;
}
public String getReservationNumber() {
return this.reservationNumer;
}
}

40
src/main/java/hs/fulda/de/ci/exam/project/Seat.java

@ -0,0 +1,40 @@
package hs.fulda.de.ci.exam.project;
public class Seat {
private SeatClass seatClass;
private SeatType seatType;
private String seatNumber;
public Seat(String seatNumber, SeatType seatType, SeatClass seatClass) {
this.seatNumber = seatNumber;
this.seatType = seatType;
this.seatClass = seatClass;
}
public Seat(){
}
public SeatClass getSeatClass() {
return seatClass;
}
public void setSeatClass(SeatClass seatClass) {
this.seatClass = seatClass;
}
public SeatType getSeatType() {
return seatType;
}
public void setSeatType(SeatType seatType) {
this.seatType = seatType;
}
public String getSeatNumber() {
return seatNumber;
}
public void setSeatNumber(String seatNumber) {
this.seatNumber = seatNumber;
}
}

5
src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java

@ -0,0 +1,5 @@
package hs.fulda.de.ci.exam.project;
public enum SeatClass {
Economy, EconomyPlus, PreferredEconomy, Business, FirstClass
}

5
src/main/java/hs/fulda/de/ci/exam/project/SeatType.java

@ -0,0 +1,5 @@
package hs.fulda.de.ci.exam.project;
public enum SeatType {
Regular, Accessible, EmergencyExit, ExtraLegRoom
}

29
src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java

@ -0,0 +1,29 @@
package hs.fulda.de.ci.exam.project;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class SeatTest {
@Test
public void testIfConstructorSetsValues() {
FlightSeat fSeat = new FlightSeat(100.0, "1234");
assertThat(fSeat.getFare()).isEqualTo(100.0);
assertThat(fSeat.getReservationNumber()).isEqualTo("1234");
}
@Test
public void testParentSeatClassConstructor() {
Seat seat = new Seat("14F", SeatType.Regular, SeatClass.Economy);
assertThat(seat.getSeatNumber()).isEqualTo("14F");
assertThat(seat.getSeatType()).isEqualTo(SeatType.Regular);
assertThat(seat.getSeatClass()).isEqualTo(SeatClass.Economy);
}
@Test
public void testMakingFlightTestParentClass(){
Seat seat = new FlightSeat(100.0, "1234");
assertThat(((FlightSeat) seat).getFare()).isEqualTo(100.0);
assertThat(((FlightSeat) seat).getReservationNumber()).isEqualTo("1234");
}
}

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

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

Loading…
Cancel
Save