Cosmic Module

O

Qubits of DPK

April 7, 2026

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

Title

FINERACT-2454: Migrate LoanWithdrawnByApplicantIntegrationTest from RestAssured to Feign Client

1. Overview

This PR is part of the FINERACT-2454 initiative, which aims to modernize Apache Fineract integration tests.
The goal is to replace RestAssured based HTTP tests with the Fineract Feign client.
In this PR, the integration test:
plain text
QUBITS OF DPK
1LoanWithdrawnByApplicantIntegrationTest
was migrated.

2. What This Test Verifies

This test verifies the loan withdrawal by applicant workflow.

Scenario

plain text
QUBITS OF DPK
1Client applies for loan
23Loan application exists
45Applicant withdraws loan
67Loan status becomes WITHDRAWN_BY_APPLICANT
This operation corresponds to the API endpoint:
plain text
QUBITS OF DPK
1POST /loans/{loanId}?command=withdrawnByApplicant

3. Problem in the Old Implementation

Previously the test used RestAssured to make HTTP calls.
Example pattern:
plain text
QUBITS OF DPK
1given()
2    .header("Authorization", token)
3    .body(request)
4.when()
5    .post("/loans/" + loanId + "?command=withdrawnByApplicant")
6.then()
7    .statusCode(200);

Issues with this approach

Example problem:
plain text
QUBITS OF DPK
1"/loans/" + loanId + "?command=withdrawnByApplicant"
If the endpoint changes, every test must be updated manually.

4. Old Test Flow (RestAssured)

plain text
QUBITS OF DPK
1Integration Test
23RestAssured
45Manual HTTP POST request
67/loans/{loanId}?command=withdrawnByApplicant
89Fineract REST Controller
The test itself was responsible for:
  • building the HTTP request
  • serializing JSON
  • validating responses

5. New Implementation (Feign Client)

After this PR, the test uses the Fineract generated API client.
Example usage:
plain text
QUBITS OF DPK
1LoansApi loansApi = client.loansApi();
2
3loansApi.withdrawLoan(loanId, request);

What happens internally

The Feign client:
  • builds the HTTP request
  • serializes request objects
  • deserializes response DTOs
The test now focuses only on business logic verification.

6. Code Structure Before vs After

Before (RestAssured)

plain text
QUBITS OF DPK
1given()
2.header("Authorization", token)
3.body(request)
4.when()
5.post("/loans/" + loanId + "?command=withdrawnByApplicant")
6.then()
7.statusCode(200);
Characteristics:
  • raw HTTP calls
  • manual endpoint construction
  • manual JSON handling

After (Feign Client)

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

7. Internal Flow After Migration

plain text
QUBITS OF DPK
1Integration Test
23LoansApi.withdrawLoan()
45Fineract Feign Client
67HTTP POST request generated
89Fineract REST API
The test code no longer handles HTTP details.

8. Benefits of This Change

9. Impact on Fineract Codebase

This PR contributes to the long-term goal of removing RestAssured tests completely.
Benefits for the project:
  • modern testing infrastructure
  • easier API evolution
  • consistent client usage