diff --git a/fineract-core/src/test/java/org/apache/fineract/infrastructure/core/service/IpAddressUtilsTest.java b/fineract-core/src/test/java/org/apache/fineract/infrastructure/core/service/IpAddressUtilsTest.java index 75cb3e8d4b1..119f572222c 100644 --- a/fineract-core/src/test/java/org/apache/fineract/infrastructure/core/service/IpAddressUtilsTest.java +++ b/fineract-core/src/test/java/org/apache/fineract/infrastructure/core/service/IpAddressUtilsTest.java @@ -12,9 +12,7 @@ * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * KIND, either express or implied. */ package org.apache.fineract.infrastructure.core.service; @@ -34,14 +32,14 @@ void clearContext() { RequestContextHolder.resetRequestAttributes(); } - // Proper isolation helper + // Helper method for setting request context private void withRequest(HttpServletRequest request, Runnable testLogic) { ServletRequestAttributes attributes = new ServletRequestAttributes(request); try { RequestContextHolder.setRequestAttributes(attributes); testLogic.run(); } finally { - RequestContextHolder.resetRequestAttributes(); // critical cleanup + RequestContextHolder.resetRequestAttributes(); } } @@ -86,4 +84,4 @@ void getClientIpConvertsNonStringAttributeUsingToString() { assertEquals("12345", result); }); } -} +} \ No newline at end of file