Repository navigation
Unit Test for Transactionwebhooks (PR #2071) - #2082
ashwaniarya-adyen wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds test coverage for the deserialization of transaction webhooks related to issued cards. It introduces a mock JSON payload representing a transaction created webhook and adds two unit tests in BalancePlatformWebhooksTest.java to verify the parsing of card category data and the forward compatibility of the card network variant enum. The review feedback suggests optimizing the test by storing the result of webhookHandler.getTransactionNotificationRequestV4() in an Optional to avoid redundant JSON deserialization.
| Assertions.assertTrue(webhookHandler.getTransactionNotificationRequestV4().isPresent()); | ||
| TransactionNotificationRequestV4 request = | ||
| webhookHandler.getTransactionNotificationRequestV4().get(); |
There was a problem hiding this comment.
Calling webhookHandler.getTransactionNotificationRequestV4() twice triggers redundant JSON deserialization of the payload. It is more efficient and consistent with other tests in this class to store the result in an Optional first.
| Assertions.assertTrue(webhookHandler.getTransactionNotificationRequestV4().isPresent()); | |
| TransactionNotificationRequestV4 request = | |
| webhookHandler.getTransactionNotificationRequestV4().get(); | |
| Optional<TransactionNotificationRequestV4> requestOptional = webhookHandler.getTransactionNotificationRequestV4(); | |
| Assertions.assertTrue(requestOptional.isPresent()); | |
| TransactionNotificationRequestV4 request = requestOptional.get(); |
|



Adds test coverage for the transactionwebhooks IssuedCard model (#2071).