Skip to content

FINERACT-2649: Migrate Tier 1 loan integration tests to Feign client#6005

Open
DeathGun44 wants to merge 1 commit into
apache:developfrom
DeathGun44:FINERACT-2649/batch-migrate-loan-tests-to-feign-s1
Open

FINERACT-2649: Migrate Tier 1 loan integration tests to Feign client#6005
DeathGun44 wants to merge 1 commit into
apache:developfrom
DeathGun44:FINERACT-2649/batch-migrate-loan-tests-to-feign-s1

Conversation

@DeathGun44

@DeathGun44 DeathGun44 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Description

Migrates 5 Tier 1 loan integration tests from BaseLoanIntegrationTest (REST-assured) to FeignLoanTestBase (Feign client).

Migrated tests

  • LoanPrepayAmountTest
  • LoanProductWithChargeOffBehaviourTest
  • LoanInterestRateFrequencyTest
  • LoanDueCalculationTest
  • FixedLengthLoanProductIntegrationTest

Infrastructure additions

  • Added retrieveLoanProduct and updateLoanProduct (typed) methods to FeignLoanHelper
  • Added updateLoanProduct(Long, String) raw JSON overload in FeignLoanTestBase for explicit null values (the NON_NULL ObjectMapper prevents typed null serialization)
  • Added REST-assured requestSpec/responseSpec to FeignLoanTestBase for raw JSON edge cases
  • Added loan product templates to LoanProductTemplates (onePeriod30DaysPeriodicAccrual, fourPeriod1MonthWithoutInterest, etc.)
  • Added payment allocation helpers and loan request builders to LoanRequestBuilders (applyLoanRequest, applyLP2ProgressiveLoanRequest, approveLoan with expected disbursement date)
  • Added schedule and transaction validation helpers to LoanTestValidators (verifyRepaymentSchedule, verifyTransactions)
  • Extended FeignLoanTestBase with migrated helpers from BaseLoanIntegrationTest (product builders, installment/transaction wrappers, create4IProgressive, etc.)

Bug fixes

  • FeignClientHelper.createClient() - use fixed past activation date (04 March 2011) matching ClientHelper.DEFAULT_DATE instead of real system date
  • FeignBusinessDateHelper - added overloads accepting an explicit dateFormat parameter
  • FeignLoanTestBase.runAt() / updateBusinessDate() - auto-detect date format (yyyy-MM-dd for ISO dates, dd MMMM yyyy for human-readable dates) so migrated tests and existing Feign tests remain compatible

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.

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

@Aman-Mittal

Copy link
Copy Markdown
Member

@DeathGun44 pls try rebase

@DeathGun44 DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s1 branch from 97fc7c9 to bd1f0eb Compare June 20, 2026 19:14
@DeathGun44

Copy link
Copy Markdown
Contributor Author

@Aman-Mittal Done!

@DeathGun44 DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s1 branch 4 times, most recently from b3c87d6 to d1fbbe7 Compare June 21, 2026 10:19
* Updates a loan product using raw JSON. Use this overload when you need to send explicit null values in the
* request body, which the typed Feign client cannot express due to the global NON_NULL ObjectMapper configuration.
*/
protected void updateLoanProduct(Long productId, String rawJsonBody) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is a workaround, but this change will force to load restassured on every subclass, which is not ideal. Can we separate this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! It's now a private method in FixedLengthLoanProductIntegrationTest.

LoanTestValidators.verifyRepaymentSchedule(loanDetails, installments);
}

protected PostLoanProductsRequest create4IProgressive() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we consolidate this kind of product creation into the LoanProductTemplates? I think this belongs there

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Moved create4IProgressive() to LoanProductTemplates as a default method.


public Long createClient() {
return createClient(Utils.dateFormatter.format(Utils.getLocalDateOfTenant()));
return createClient("04 March 2011");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic string

@DeathGun44 DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s1 branch from d1fbbe7 to 74ae125 Compare June 21, 2026 15:46
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
@DeathGun44 DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s1 branch from 74ae125 to db1f724 Compare June 21, 2026 16:45
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.

3 participants