[ 
https://issues.apache.org/jira/browse/FINERACT-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

devi pathak updated FINERACT-2540:
----------------------------------
    Description: 
##{*}Description{*}

The IpAddressUtils utility class currently does not have dedicated unit test 
coverage.

This improvement introduces unit tests for the getClientIp() method to verify 
its behavior under different request context scenarios.

The tests cover the following cases:
 - When no request context is available
 - When a request context exists but the IP attribute is missing
 - When a valid IP attribute is present
 - When the IP attribute is a non-string object and must be converted via 
toString()

These tests help ensure the correct behavior of client IP extraction logic and 
improve test coverage for request-related utilities in the infrastructure 
module.

*Motivation*
Adding unit tests improves reliability and prevents regressions in request 
utility helpers that are used across the application.

##{*}Proposed Solution{*}

Create a new test class:

fineract-core/src/test/java/org/apache/fineract/infrastructure/core/service/IpAddressUtilsTest.java

and add tests validating the behavior of getClientIp() under various request 
context conditions.

  was:
##Description

The IpAddressUtils utility class currently does not have dedicated unit test 
coverage.

This improvement introduces unit tests for the getClientIp() method to verify 
its behavior under different request context scenarios.

The tests cover the following cases:
 - When no request context is available
 - When a request context exists but the IP attribute is missing
 - When a valid IP attribute is present
 - When the IP attribute is a non-string object and must be converted via 
toString()

These tests help ensure the correct behavior of client IP extraction logic and 
improve test coverage for request-related utilities in the infrastructure 
module.

## Motivation
Adding unit tests improves reliability and prevents regressions in request 
utility helpers that are used across the application.

##Proposed Solution

Create a new test class:

fineract-core/src/test/java/org/apache/fineract/infrastructure/core/service/IpAddressUtilsTest.java

and add tests validating the behavior of getClientIp() under various request 
context conditions.


> Add unit tests for IpAddressUtils utility class
> -----------------------------------------------
>
>                 Key: FINERACT-2540
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2540
>             Project: Apache Fineract
>          Issue Type: Improvement
>            Reporter: devi pathak
>            Priority: Major
>              Labels: gsoc-fineract-evidence, infrastructure, test
>
> ##{*}Description{*}
> The IpAddressUtils utility class currently does not have dedicated unit test 
> coverage.
> This improvement introduces unit tests for the getClientIp() method to verify 
> its behavior under different request context scenarios.
> The tests cover the following cases:
>  - When no request context is available
>  - When a request context exists but the IP attribute is missing
>  - When a valid IP attribute is present
>  - When the IP attribute is a non-string object and must be converted via 
> toString()
> These tests help ensure the correct behavior of client IP extraction logic 
> and improve test coverage for request-related utilities in the infrastructure 
> module.
> *Motivation*
> Adding unit tests improves reliability and prevents regressions in request 
> utility helpers that are used across the application.
> ##{*}Proposed Solution{*}
> Create a new test class:
> fineract-core/src/test/java/org/apache/fineract/infrastructure/core/service/IpAddressUtilsTest.java
> and add tests validating the behavior of getClientIp() under various request 
> context conditions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to