Skip to content

FINERACT-2824: Migrate loan lifecycle and product integration tests to the Feign client - #6433

Open
DeathGun44 wants to merge 6 commits into
apache:developfrom
DeathGun44:FINERACT-2824/migrate-loan-lifecycle-product-cob-tests-to-feign
Open

DeathGun44 wants to merge 6 commits into
apache:developfrom
DeathGun44:FINERACT-2824/migrate-loan-lifecycle-product-cob-tests-to-feign

Conversation

@DeathGun44

Copy link
Copy Markdown
Contributor

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!

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.
  • I followed the AI Policy.

Your assigned reviewer(s) will follow our guidelines for code reviews.

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.
@DeathGun44 DeathGun44 changed the title FINERACT-2824: migrate loan lifecycle product cob tests to feign FINERACT-2824: Migrate loan lifecycle and product integration tests to the Feign client Sep 11, 2026
@DeathGun44

Copy link
Copy Markdown
Contributor Author

@budaidev @adamsaghy Please take a look when you have a moment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant