Cosmic Module

O

Qubits of DPK

April 7, 2026

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

Title

FINERACT-2454: Migrate Integration Tests from RestAssured to Feign Client

1. Overview

This PR continues the FINERACT-2454 test modernization effort in Apache Fineract.
The main objective of this change is to migrate existing integration tests from RestAssured to the Fineract Feign client.
Previously, integration tests were responsible for manually constructing HTTP requests and handling JSON responses.
After this migration, tests use typed API client interfaces, which simplifies test logic and improves maintainability.

2. What This PR Changes

This PR migrates one or more integration tests that previously relied on RestAssured HTTP calls.
The migration replaces:
plain text
QUBITS OF DPK
1RestAssured HTTP based tests
with
plain text
QUBITS OF DPK
1Fineract Feign client based tests
As a result:
  • Tests no longer manually create HTTP requests.
  • API calls are executed using typed Java interfaces.

3. Problem in the Old Implementation

Previously, integration tests used RestAssured.
Example pattern:
plain text
QUBITS OF DPK
1given()
2.header("Authorization", token)
3.body(request)
4.when()
5.post("/loans")
6.then()
7.statusCode(200);

Limitations

These issues made integration tests:
  • harder to read
  • harder to maintain
  • more prone to break when APIs changed

4. Old Test Flow (RestAssured)

Before this PR, the test flow looked like this:
plain text
QUBITS OF DPK
1Integration Test
23RestAssured
45Manual HTTP request
67Fineract REST endpoint
89Response JSON parsed manually
The test itself handled:
  • building the HTTP request
  • converting objects to JSON
  • parsing response JSON

5. New Implementation (Feign Client)

After the migration, tests use the Fineract Feign client.
Example usage:
plain text
QUBITS OF DPK
1LoansApi loansApi = client.loansApi();
2
3loansApi.createLoan(request);
The Feign client automatically handles:
  • HTTP request creation
  • request serialization
  • response deserialization
This removes unnecessary complexity from the tests.

6. Code Structure Before vs After

Before (RestAssured)

plain text
QUBITS OF DPK
1given()
2.body(request)
3.post("/loans")
4.then()
5.statusCode(200);
Characteristics:
  • raw HTTP request
  • string-based endpoint
  • manual request handling

After (Feign Client)

plain text
QUBITS OF DPK
1LoansApi loansApi = client.loansApi();
2
3loansApi.createLoan(request);
Characteristics:
  • typed API interface
  • request objects automatically serialized
  • response mapped to DTO models

7. Internal Flow After Migration

plain text
QUBITS OF DPK
1Integration Test
23LoansApi.createLoan()
45Fineract Feign Client
67HTTP request generated automatically
89Fineract REST Controller
The integration test now focuses only on verifying business logic and API behavior, not HTTP mechanics.

8. Benefits of This Change

9. Impact on Fineract Codebase

This PR contributes to the long-term goal of:
plain text
QUBITS OF DPK
1Eliminating RestAssured usage in integration tests
Benefits for the project include:
  • modernized testing architecture
  • consistent API client usage
  • easier future refactoring
If you want, I’ll give the next one (PR #5670).
That one is important because it migrates the ClientLoanAccountLockIntegrationTest, which tests loan account locking behavior, and it will help you understand how loan state transitions are tested in Fineract.