diff --git a/src/main/java/hs/fulda/de/ci/exam/project/Seat.java b/src/main/java/hs/fulda/de/ci/exam/project/Seat.java new file mode 100644 index 0000000..8aab462 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java b/src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java new file mode 100644 index 0000000..fec9a4a --- /dev/null +++ b/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 +} diff --git a/src/main/java/hs/fulda/de/ci/exam/project/SeatType.java b/src/main/java/hs/fulda/de/ci/exam/project/SeatType.java new file mode 100644 index 0000000..c5d76a0 --- /dev/null +++ b/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 +} diff --git a/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java b/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java index b48e261..a249aca 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java +++ b/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 { @Test - void testIfConstructorSetsValues() { + 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); + } } diff --git a/target/classes/hs/fulda/de/ci/exam/project/Itinerary.class b/target/classes/hs/fulda/de/ci/exam/project/Itinerary.class index b5fe1ba..b7c1f85 100644 Binary files a/target/classes/hs/fulda/de/ci/exam/project/Itinerary.class and b/target/classes/hs/fulda/de/ci/exam/project/Itinerary.class differ diff --git a/target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class b/target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class index 2193c80..1b55663 100644 Binary files a/target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class and b/target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class differ