From 92b1faa9c3ea4778e1c29f062e6019bcf75ef2b9 Mon Sep 17 00:00:00 2001 From: Imron Date: Wed, 16 Feb 2022 17:26:38 +0100 Subject: [PATCH] cash transaction --- .../hs/fulda/de/ci/exam/project/CashTransaction.java | 12 ++++++++++++ .../hs/fulda/de/ci/exam/project/PaymentTest.java | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/main/java/hs/fulda/de/ci/exam/project/CashTransaction.java diff --git a/src/main/java/hs/fulda/de/ci/exam/project/CashTransaction.java b/src/main/java/hs/fulda/de/ci/exam/project/CashTransaction.java new file mode 100644 index 0000000..7c17bde --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/CashTransaction.java @@ -0,0 +1,12 @@ +package hs.fulda.de.ci.exam.project; + +public class CashTransaction extends Payment { + public CashTransaction(int id, String amount, PaymentStatus status) { + super(id, amount, status); + } + + @Override + public boolean isValid() { + return true; + } +} diff --git a/src/test/java/hs/fulda/de/ci/exam/project/PaymentTest.java b/src/test/java/hs/fulda/de/ci/exam/project/PaymentTest.java index f5fa7b4..9e1a2b4 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/PaymentTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/PaymentTest.java @@ -43,6 +43,15 @@ public class PaymentTest { assertEquals(Failed, bank_payment.status); } + @Test + public void cashPaymentShouldBePossible(){ + CashTransaction cash_payment = new CashTransaction(11, "139€", Unpaid); + FlightReservation reservation = new FlightReservation(); + reservation.makePayment(cash_payment); + assertEquals(Confirmed, reservation.getStatus()); + assertEquals(Completed, cash_payment.status); + } + }