Cosmic Module

O

Qubits of DPK

April 7, 2026

Core Open Source

Overview

Apache Fineract uses Spring Boot integration tests to verify the behavior of its REST APIs.
These tests start a real application context and interact with the system through HTTP requests.
With the modernization effort (FINERACT-2454), tests now use the Fineract Feign client instead of manually calling APIs using RestAssured.
This allows integration tests to simulate real client interactions with the Fineract API.

High-Level Architecture of Integration Tests

plain text
QUBITS OF DPK
1Integration Test
23Fineract Feign Client
45Generated API Interfaces
67HTTP Request
89Spring Boot Application
1011Fineract Services
1213Database (Test DB)
The test environment behaves almost like a real running Fineract server.

Key Components of the Integration Test Framework

1. Spring Boot Test Environment

Fineract integration tests run with Spring Boot test configuration.
The test framework:
  • starts the Spring Boot application
  • initializes all beans
  • configures the database
  • exposes REST APIs
Typical annotation used:
plain text
QUBITS OF DPK
1@SpringBootTest
This loads the entire application context.

2. AbstractIntegrationTest

Most integration tests extend:
plain text
QUBITS OF DPK
1AbstractIntegrationTest
This class provides common test utilities.
Responsibilities include:
Example usage:
plain text
QUBITS OF DPK
1public class LoanWithdrawnByApplicantIntegrationTest extends AbstractIntegrationTest {
2}
This gives the test access to shared utilities and configuration.

3. Authentication Handling

Fineract APIs require authentication.
The integration test framework automatically generates admin authentication tokens.
Typical flow:
plain text
QUBITS OF DPK
1Integration Test
23Login API
45Receive authentication token
67Token used for API calls
In tests, this token is automatically attached to requests.
This allows tests to simulate authenticated API calls.

4. Fineract Feign Client

The Feign client is the core improvement introduced in your PRs.
Instead of manual HTTP calls, the tests use generated API clients.
Example:
plain text
QUBITS OF DPK
1LoansApi loansApi = client.loansApi();
This API interface corresponds to:
plain text
QUBITS OF DPK
1/loans REST endpoints
Calling a method like:
plain text
QUBITS OF DPK
1loansApi.withdrawLoan(loanId, request);
will internally generate the HTTP request.

How the Feign Client Works

The Feign client performs several tasks automatically.

Request Handling

plain text
QUBITS OF DPK
1Java Request Object
23Feign Client
45JSON Serialization
67HTTP Request

Response Handling

plain text
QUBITS OF DPK
1HTTP Response
23Feign Client
45JSON Deserialization
67Java DTO Object
This removes the need for manual JSON handling in tests.

5. DTO Models

The API client uses Data Transfer Objects (DTOs).
Example request model:
plain text
QUBITS OF DPK
1PostLoansRequest
Example response model:
plain text
QUBITS OF DPK
1PostLoansResponse
These DTOs ensure:
  • structured API requests
  • structured responses
  • compile-time validation

6. Integration Test Execution Flow

A typical integration test follows this sequence:
plain text
QUBITS OF DPK
1Start Spring Boot Application
23Initialize Test Database
45Create API Client
67Authenticate User
89Execute API Calls
1011Verify API Response
Example test logic:
plain text
QUBITS OF DPK
1LoansApi loansApi = client.loansApi();
2
3loansApi.withdrawLoan(loanId, request);
The test then verifies:
  • status changes
  • response fields
  • system behavior

How Your PRs Fit Into This Architecture

Your pull requests specifically modified how integration tests communicate with the API.

Before Your PRs

plain text
QUBITS OF DPK
1Integration Test
23RestAssured
45Manual HTTP Requests

After Your PRs

plain text
QUBITS OF DPK
1Integration Test
23Fineract Feign Client
45Typed API Interfaces
This migration improves:
  • test readability
  • maintainability
  • API consistency

Why This Modernization Is Important

Large systems like Fineract contain hundreds of integration tests.
Using manual HTTP calls causes:
  • duplicated code
  • fragile tests
  • difficult maintenance
Using a generated API client solves these issues and aligns tests with how real clients integrate with Fineract.

Summary

The Fineract integration testing framework works by running a real Spring Boot application instance and executing API calls against it.
Your pull requests contribute to improving this framework by replacing manual HTTP testing with a typed Feign client, which provides a cleaner and more maintainable approach for integration testing.