Skip to content

FINERACT-2649: Migrate Tier 3 loan integration tests to Feign client#6084

Open
DeathGun44 wants to merge 14 commits into
apache:developfrom
DeathGun44:FINERACT-2649/batch-migrate-loan-tests-to-feign-s3
Open

FINERACT-2649: Migrate Tier 3 loan integration tests to Feign client#6084
DeathGun44 wants to merge 14 commits into
apache:developfrom
DeathGun44:FINERACT-2649/batch-migrate-loan-tests-to-feign-s3

Conversation

@DeathGun44

@DeathGun44 DeathGun44 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

This PR transitions 47 test classes (encompassing approximately 275 test methods) to utilize the Feign client, entirely removing their dependency on REST-assured.

Note on behavior: The core test behavior and assertions remain completely unchanged. This is strictly a refactor of the underlying HTTP client layer.

Targeted commits

I've split this work into 14 commits, grouped logically by test , APA, down-payments, etc.): two commits extending the shared Feignhelpers, eleven migration batches, plus a dedicated review-feedback refinement commit.

This ensures that if CI fails or issues arise later, it is much easier to isolate and track down the specific batch that introduced the regression.

Scope

Included in this PR:

  • Comprehensive loan rescheduling coverage (core reschedule requestsschedule with advance payments, center/group rescheduling) plusre-aging and re-amortization tests.
  • Chargeback integration scenarios (non-APA workflows, down-payment nquency-and-chargeback interaction).
  • Down-payment workflows (product configuration, transaction typing, undo disbursal / undo repayment, disbursement-to-savings with auto down-payment, overlapping
    down-payment installment allocation, repayment schedules).
  • Advanced Payment Allocation (APA) coverage: charge-off, charge reverse-replay, write-offs, transaction reprocessing, refunds for active loans, charge payment, and
    installment-fee error handling.
  • Client loan lifecycle tests (credit balance refund, external-id support, backdated disbursement, overpaid date status, modify approved amount, floating rate interest
    recalculation, repayment calculation, and date validations).
  • Core loan account, loan transaction, and loan summary tests, plus charge-off accounting and repayment-reversal external-id tests.
  • Standardization of BigDecimal precision assertions across migration

Review Feedback & OpenAPI Refinements

Based on maintainer review feedback, the production-code footprint of this PR has been reduced to 11 purely additive schema-documentation lines across 2 Swagger files - no behavioral changes:

  • LoanTransactionsApiResourceSwagger: The earlier @ApiResponstionTemplate has been dropped. Instead, the fields the endpointalready returns for reAge/reAmortize templates (numberOfPastInstallments, numberOfFutureInstallments, nextInstallmentDueDate, calculatedStartDate) are now documented on the existing response schema. This lets the standard glize these templates directly — the interim customInternalLoanReAgeApi workaround interface has been removed.
  • SavingsProductsApiResourceSwagger: Documented the existing `sponse field.
  • Strongly Typed Response Models: Replaced untyped HashMap<String, Object> test builder responses with strongly-typed generated models (PostLoansResponse, PostLoansLoanIdResponse).
  • Date Readability: Standardized LocalDate.of(...) calls to use concise numeric month parameters, matching the pre-migration originals.

Bug Fix:

pre-existing bug ondevelop in two test methods: - `testUndoDisbursalForLoanWithSingleDisbursalAutoDownPaymentEnabled

  • testUndoDisbursalForLoanWithMultiDisbursalAutoDownPaymentEnabledAndHasManualTransactions
    Both tests make a manual repayment of 100.0 after disbursement, then undo the disbursal. The "repayment entries compensated" journal entry assertions incorrectly expected 250.0 (the down-payment amount) instead of 100.0 (tThe old REST-assured based verifyJournalEntries() had more lenientmatching semantics that masked this error. Fixed as part of the migration commit.

Infrastructure Enhancements

This PR builds upon the shared Feign test infrastructure from earlie

  • FeignGroupCenterHelper (new): Utilities for managing group a loan testing.
  • Extended shared builders & helpers: reAmortize/reAge, write-off, and credit-allocation support in the loan helpers; external-id and business-date extensions; journal-entry, charge, code-value, external-event, and global-configing the migrated tests.
  • FeignRawHttpHelper (extended): Safely handles edge cases that require raw HTTP requests to bypass strict Swagger model limitations (e.g., floating rate
    properties), utilizing fineract.it.url securely.

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.

@DeathGun44

Copy link
Copy Markdown
Contributor Author

the test is failing and the issue is in develop itself, because a reversal of a 100.0 repayment should produce 100.0 journal entries, not 250.0. i am adding a fix for it in the pr and describing it in the description aswell

@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch from 9276e89 to 1d32a0e Compare July 3, 2026 15:11

@Aman-Mittal Aman-Mittal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am still reviewing this one.....

@Aman-Mittal
Aman-Mittal requested a review from budaidev July 3, 2026 15:56
@Aman-Mittal Aman-Mittal added the java Pull requests that update Java code label Jul 3, 2026
@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch from 1d32a0e to ba3e948 Compare July 5, 2026 19:29
@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch from ba3e948 to 07c5b62 Compare July 5, 2026 22:17
@adamsaghy

Copy link
Copy Markdown
Contributor

@DeathGun44 Please rebase.

@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch from 07c5b62 to 94261bf Compare July 6, 2026 09:45
@DeathGun44

Copy link
Copy Markdown
Contributor Author

@adamsaghy Done!

@adamsaghy
adamsaghy requested a review from budaidev July 6, 2026 13:43

@budaidev budaidev left a comment

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.

The PR has a massive scope and a lot of changes, so the lot of comments doesn't mean it's bad, but I would advise to fix those to keep the refactor clean. The direction is really good.

Also please avoid any behavior changes in the test, by modifying or removing assertations, because it could lead silent errors.

@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch 2 times, most recently from 6f8e2c3 to e9acca1 Compare July 7, 2026 10:56
@DeathGun44

DeathGun44 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@budaidev Thank you for the thorough review! I enjoy all these reviews as they help me learn a lot. I know there is a lot of code to go through. I will keep trying my best to make it as clean as possible and easier to review, and I'll make sure the quality of the code doesn't deteriorate with these bulk prs. Thanks again, everyone, for keeping up!

@adamsaghy
adamsaghy requested a review from budaidev July 7, 2026 12:54

@budaidev budaidev left a comment

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.

looks good, great progress

@budaidev

budaidev commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

please rebase and handle the conflicts

@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch from e9acca1 to 13dc9db Compare July 7, 2026 18:51
@DeathGun44

Copy link
Copy Markdown
Contributor Author

@adamsaghy @budaidev Done!

@budaidev
budaidev requested a review from adamsaghy July 7, 2026 19:00
@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch from 95843e5 to 593eded Compare July 8, 2026 12:36
@DeathGun44

Copy link
Copy Markdown
Contributor Author

Regarding the OpenAPI backward-compatibility check failure: this is expected due to updating the @apiresponse schema on retrieveTransactionTemplate from GetLoansLoanIdTransactionsTemplateResponse to LoanTransactionData.

Inspecting LoanTransactionsApiResource.java shows the endpoint uses DefaultToApiJsonSerializer and has always returned LoanTransactionData on the wire at runtime. The previous OpenAPI annotation was incorrect. This change aligns the Swagger spec with actual runtime behavior, so there is no real-world breaking change for API consumers.

@DeathGun44

Copy link
Copy Markdown
Contributor Author

the other test failure is just flaky ,should pass on rerun.
I have also updated the pr description with regard to the current state

@DeathGun44
DeathGun44 requested a review from adamsaghy July 8, 2026 13:24
@DeathGun44

Copy link
Copy Markdown
Contributor Author

@adamsaghy please take a look when you have a moment!

@adamsaghy

Copy link
Copy Markdown
Contributor

I am postponing to merge this till release of 1.15.0 is not finished

…elpers

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
… Feign

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
…sts to Feign

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
…to Feign

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
… dates

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
… Feign

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
… and down-payment schedule tests to Feign

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
…ests to Feign

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
…d Feign tests

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch from 593eded to 3514432 Compare July 16, 2026 13:41
@DeathGun44

Copy link
Copy Markdown
Contributor Author

The test is just flaky, a rerun should pass it.

@adamsaghy

Copy link
Copy Markdown
Contributor

The test is just flaky, a rerun should pass it.

nope. they seem real failures

…s, simplify runAt

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
@DeathGun44
DeathGun44 force-pushed the FINERACT-2649/batch-migrate-loan-tests-to-feign-s3 branch from 3514432 to 779a812 Compare July 16, 2026 19:01
@DeathGun44

Copy link
Copy Markdown
Contributor Author

The test is just flaky, a rerun should pass it.

nope. they seem real failures

You're right my mistake, it wasn't flaky. When I moved these tests onto the new FeignLoanTestBase, I accidentally left off the ExternalEventsExtension that BaseLoanIntegrationTest uses. That extension is what resets the external-event configuration after each test. I fixed it now!

@DeathGun44

Copy link
Copy Markdown
Contributor Author

This one seems flaky ,should pass on rerun

@DeathGun44

Copy link
Copy Markdown
Contributor Author

updated the pr description as per the current state!

@DeathGun44
DeathGun44 requested a review from adamsaghy July 17, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants