FINERACT-2824: Migrate loan lifecycle and product integration tests to the Feign client - #6433
Open
DeathGun44 wants to merge 6 commits into
Conversation
GET /loanproducts/{id} returns the product's external id - LoanProductData
carries the field - but GetLoanProductsProductIdResponse never declared it, so
the generated model had no getter and a test that retrieves a product by its
external id could not check the value round-tripped.
LoanProductExternalIdTest now asserts it.
…ests FeignRoleHelper is new: createRole and addPermissionsToRole, mirroring the REST Assured RolesHelper that the working capital loan originator test used. FeignUserHelper gains a createUser overload taking a full PostUsersRequest, for callers that set the office and roles themselves; the existing convenience overload now delegates to it. FeignLoanHelper gains retrieveLoanProductByExternalId and updateLoanProductByExternalId. FeignLoanTestBase gains extractErrorCount, the sibling of extractErrorGlobalisationCode. A validation failure reports one entry per rejected field, and LoanValidationIntegrationTest pinned that count with a REST Assured body matcher that has no typed equivalent. extractErrorGlobalisationCode also unwraps error.msg.resource.not.found now. That code is an envelope like the two the method already skipped: every AbstractPlatformResourceNotFoundException reports it at the top of the body and the entity-specific code - error.msg.loanproduct.id.invalid, say - in the nested errors array. Without it, a 404 assertion could only be made against the raw message text. The three codes move into a named constant.
LoanProductExternalIdTest, LoanProductUpdateApiTest, LoanProductWithRepaymentDueEventConfigurationTest and LoanProductRepaymentStartDateConfigurationTest move onto FeignLoanTestBase. Products are built with LoanProductTestBuilder.buildRequest rather than its JSON build(), so the request is typed end to end. The two schedule tests replace the hand-written enable-business-date / update / finally-disable block with the base runAt helper, which performs the same three steps. Delinquency buckets come from FeignDelinquencyHelper rather than DelinquencyBucketsHelper, which still calls the retrofit client. Three unused locals are dropped from LoanProductWithRepaymentDueEventConfigurationTest: a loan external id, a client and a delinquency bucket lookup that no assertion read.
LoanApplicationApprovalTest, LoanApplicationScheduleMonthlyTest, LoanApplicationRejectionForLoanProductWithPeriodicAccrualAccountingTest and LoanValidationIntegrationTest. Applications use LoanRequestBuilders.legacyIndividualApplication, which reproduces the defaults LoanApplicationTestBuilder.build() emitted without any call site naming them: maxOutstandingLoanBalance, an empty collateral list, the default strategy and the en_GB locale. Error cases keep the status their response spec pinned and now also assert the globalisation code rather than only reading it out of an error map: approval above the demanded amount is 403, the multi-disburse sum check is 400. Repayment schedule due dates are compared as LocalDate rather than the [year, month, day] lists REST Assured produced. @SuppressWarnings("rawtypes") is gone from LoanApplicationApprovalTest: the raw HashMap tranche and collateral maps it covered are typed models now.
LoanAuditingIntegrationTest reads the audit fields through the generated DefaultApi.getLoanAuditFields, matching its transaction-level sibling LoanTransactionAuditingIntegrationTest, and approves as the newly created user through a second Feign client rather than a re-headered request spec. ConcurrencyIntegrationTest drives its ten concurrent repayments through FeignTransactionHelper, and reads the net disbursal amount from the typed loan details instead of a JsonPath expression over the response body.
…inator test Only testUserWithoutPermissionsCannotAttachOrDetachOriginator still built a request spec, to create a role and a user through RolesHelper and UserHelper. Both now go through FeignRoleHelper and FeignUserHelper, and the last io.restassured import in the file is gone.
Contributor
Author
|
@budaidev @adamsaghy Please take a look when you have a moment! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.