|
@ -9,7 +9,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
public class PaymentTest { |
|
|
public class PaymentTest { |
|
|
@Test |
|
|
@Test |
|
|
public void should_be_possible_to_pay_with_credit_card(){ |
|
|
public void should_be_possible_to_pay_with_credit_card(){ |
|
|
Payment credit_card_payment = new CreditCardTransaction(11, "139€", Unpaid, "Imron Gamidli"); |
|
|
|
|
|
|
|
|
Payment credit_card_payment = new CreditCardTransaction(11, "139€", Unpaid, "01234567890123456789"); |
|
|
FlightReservation reservation = new FlightReservation(); |
|
|
FlightReservation reservation = new FlightReservation(); |
|
|
reservation.makePayment(credit_card_payment); |
|
|
reservation.makePayment(credit_card_payment); |
|
|
assertEquals(Confirmed, reservation.getStatus()); |
|
|
assertEquals(Confirmed, reservation.getStatus()); |
|
@ -25,5 +25,14 @@ public class PaymentTest { |
|
|
assertEquals(Completed, payment.status); |
|
|
assertEquals(Completed, payment.status); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void paymentShould_not_be_possible_if_credit_card_deatils_is_wrong(){ |
|
|
|
|
|
CreditCardTransaction credit_card_payment = new CreditCardTransaction(11, "139€", Unpaid, "123"); |
|
|
|
|
|
FlightReservation reservation = new FlightReservation(); |
|
|
|
|
|
reservation.makePayment(credit_card_payment); |
|
|
|
|
|
assertEquals(ReservationStatus.Cancelled, reservation.getStatus()); |
|
|
|
|
|
assertEquals(Failed, credit_card_payment.status); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |