Cosmic Module

O

Qubits of DPK

April 7, 2026

Core Open Source
https://github.com/apache/fineract/pull/5670

Title

FINERACT-2454: Migrate ClientLoanAccountLockIntegrationTest from RestAssured to Feign Client

1. Overview

This PR is part of the FINERACT-2454 integration test modernization initiative.
The objective is to migrate the integration test:
plain text
QUBITS OF DPK
1ClientLoanAccountLockIntegrationTest
from RestAssured-based HTTP testing to the Fineract Feign client.
This improves the maintainability and reliability of the test suite by removing manual HTTP calls and using typed API interfaces.

2. What This Test Verifies

This integration test validates the loan account locking workflow.
Loan account locking is used to prevent further operations on a loan account when certain conditions occur.

Scenario Tested

plain text
QUBITS OF DPK
1Client has an active loan account
23Loan account lock operation is executed
45Loan account becomes locked
67Further operations on the loan are restricted
The API endpoint involved:
plain text
QUBITS OF DPK
1POST /loans/{loanId}?command=lock
This command triggers the loan account locking process inside the Fineract loan service.

3. Problem in the Old Implementation

Previously, the test used RestAssured to manually call the API endpoint.
Example:
plain text
QUBITS OF DPK
1given()
2.header("Authorization", token)
3.when()
4.post("/loans/" + loanId + "?command=lock")
5.then()
6.statusCode(200);

Limitations of this approach

Example of fragile code:
plain text
QUBITS OF DPK
1"/loans/" + loanId + "?command=lock"
If the API path changes, every test must be updated manually.

4. Old Test Flow (RestAssured)

Before this PR, the integration test flow looked like this:
plain text
QUBITS OF DPK
1Integration Test
23RestAssured
45Manual HTTP POST request
67/loans/{loanId}?command=lock
89Loan API Controller
The test itself handled:
  • constructing the HTTP request
  • adding authentication headers
  • sending the request
  • validating the response
This added unnecessary complexity.

5. New Implementation (Feign Client)

After this PR, the test uses the Fineract Feign client.
Example usage:
plain text
QUBITS OF DPK
1LoansApi loansApi = client.loansApi();
2
3loansApi.lockLoanAccount(loanId);
The Feign client automatically performs:
  • HTTP request generation
  • request serialization
  • response deserialization
The integration test no longer needs to deal with low-level HTTP details.

6. Code Structure Before vs After

Before (RestAssured)

plain text
QUBITS OF DPK
1given()
2.header("Authorization", token)
3.when()
4.post("/loans/" + loanId + "?command=lock")
5.then()
6.statusCode(200);
Characteristics:
  • manual HTTP calls
  • string-based endpoint construction
  • repetitive boilerplate

After (Feign Client)

plain text
QUBITS OF DPK
1LoansApi loansApi = client.loansApi();
2
3loansApi.lockLoanAccount(loanId);
Characteristics:
  • typed API interface
  • automatic request generation
  • DTO-based responses

7. Internal Flow After Migration

plain text
QUBITS OF DPK
1Integration Test
23LoansApi.lockLoanAccount()
45Fineract Feign Client
67HTTP POST request generated automatically
89Loan REST Controller
1011Loan Service
The Feign client acts as a typed abstraction layer over the REST API.

8. Benefits of This Change

9. Impact on Fineract Codebase

This PR contributes to the ongoing integration test modernization.
Key impacts:
  • standardizes how integration tests interact with APIs
  • reduces duplicated HTTP boilerplate
  • improves long-term maintainability of the test suite
This migration is part of the broader effort to completely remove RestAssured usage from the Fineract integration test framework.