-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve deserialization unit testing #1421
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work
|
||
PaymentRequest parsedCheckoutPaymentRequest = PaymentRequest.fromJson(paymentRequestJson); | ||
assertNotNull(parsedCheckoutPaymentRequest.getPaymentMethod()); | ||
assertEquals(CardDetails.TypeEnum.SCHEME, parsedCheckoutPaymentRequest.getPaymentMethod().getCardDetails().getType()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improvement: Let's assert that all properties are populated correctly after deserialization, not just SCHEME
but also encryptedExpiryMonth
etc. (see paymentRequestScheme.json mock)
paymentRequest.setReturnUrl("http://return.com"); | ||
paymentRequest.setPaymentMethod(new CheckoutPaymentMethod(idealDetails)); | ||
public void TestDeserializePaymentRequestIdeal() throws Exception { | ||
String paymentRequestJson = getFileContents("mocks/checkout/paymentRequestIdeal.json"); | ||
|
||
PaymentRequest parsedCheckoutPaymentRequest = PaymentRequest.fromJson(paymentRequestJson); | ||
assertEquals(IdealDetails.TypeEnum.IDEAL, parsedCheckoutPaymentRequest.getPaymentMethod().getIdealDetails().getType()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improvement: idem. see comment below
|
PR to:
scheme
TestDeserializePaymentRequestIdeal
)