Browse Source

making flightseat child of seat

feature-pr-seatFlightSeat
Imron 3 years ago
parent
commit
d2789b3e65
  1. 3
      src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java
  2. 3
      src/main/java/hs/fulda/de/ci/exam/project/Seat.java
  3. 7
      src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java

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

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

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

@ -10,6 +10,9 @@ public class Seat {
this.seatType = seatType;
this.seatClass = seatClass;
}
public Seat(){
}
public SeatClass getSeatClass() {
return seatClass;

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

@ -19,4 +19,11 @@ public class SeatTest {
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");
}
}
Loading…
Cancel
Save