Browse Source

parent class seat

feature-pr-seatFlightSeat
Imron 3 years ago
parent
commit
b1a36a043c
  1. 37
      src/main/java/hs/fulda/de/ci/exam/project/Seat.java
  2. 5
      src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java
  3. 5
      src/main/java/hs/fulda/de/ci/exam/project/SeatType.java
  4. 10
      src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java
  5. BIN
      target/classes/hs/fulda/de/ci/exam/project/Itinerary.class
  6. BIN
      target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class

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

@ -0,0 +1,37 @@
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 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
}

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

@ -6,9 +6,17 @@ import static org.assertj.core.api.Assertions.assertThat;
public class SeatTest { public class SeatTest {
@Test @Test
void testIfConstructorSetsValues() {
public void testIfConstructorSetsValues() {
FlightSeat fSeat = new FlightSeat(100.0, "1234"); FlightSeat fSeat = new FlightSeat(100.0, "1234");
assertThat(fSeat.getFare()).isEqualTo(100.0); assertThat(fSeat.getFare()).isEqualTo(100.0);
assertThat(fSeat.getReservationNumber()).isEqualTo("1234"); 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);
}
} }

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