Skip to content

Commit 5fa8955

Browse files
committed
FINERACT-5706: Add unit tests for IpAddressUtils
Signed-off-by: Shlesha <shlesha04@gmail.com>
1 parent bbece9c commit 5fa8955

1 file changed

Lines changed: 3 additions & 21 deletions

File tree

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

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
/**
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
191
package org.apache.fineract.infrastructure.core.service;
202

213
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -34,14 +16,14 @@ void clearContext() {
3416
RequestContextHolder.resetRequestAttributes();
3517
}
3618

37-
// Proper isolation helper
19+
// Helper method for setting request context
3820
private void withRequest(HttpServletRequest request, Runnable testLogic) {
3921
ServletRequestAttributes attributes = new ServletRequestAttributes(request);
4022
try {
4123
RequestContextHolder.setRequestAttributes(attributes);
4224
testLogic.run();
4325
} finally {
44-
RequestContextHolder.resetRequestAttributes(); // critical cleanup
26+
RequestContextHolder.resetRequestAttributes();
4527
}
4628
}
4729

@@ -86,4 +68,4 @@ void getClientIpConvertsNonStringAttributeUsingToString() {
8668
assertEquals("12345", result);
8769
});
8870
}
89-
}
71+
}

0 commit comments

Comments
 (0)