commons-lang3 3.13 → 3.13.1 업그레이드와 코드 최적화
- Strings API로 대체 및 StringUtils 불필요 메서드 제거 - CellPhoneValidator 시작 번호 체크 로직 개선
This commit is contained in:
+5
-4
@@ -11,6 +11,7 @@ import com.eactive.apim.portal.common.util.UserTypeUtil;
|
||||
import com.eactive.apim.portal.common.validator.CellPhoneValidator;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -46,21 +47,21 @@ class CommonsLangUpgradeCompatibilityTest {
|
||||
() -> assertEquals("", StringUtils.trimToEmpty(null)),
|
||||
() -> assertEquals("api-001", StringUtils.defaultIfBlank(" ", "api-001")),
|
||||
() -> assertEquals("API 이름", StringUtils.defaultIfBlank("API 이름", "api-001")),
|
||||
() -> assertTrue(StringUtils.equalsAnyIgnoreCase(" Y ".trim(), "true", "y", "1"))
|
||||
() -> assertTrue(Strings.CI.equalsAny(" Y ".trim(), "true", "y", "1"))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("API 경로와 메시지 리소스명 문자열 처리가 유지된다")
|
||||
void keepsPathAndResourceNameBehavior() {
|
||||
String fullPath = StringUtils.join("/openapi/", "/", StringUtils.removeStart("/users", "/"));
|
||||
String normalizedPath = StringUtils.replacePattern(fullPath, "//+", "/");
|
||||
String fullPath = StringUtils.join("/openapi/", "/", Strings.CS.removeStart("/users", "/"));
|
||||
String normalizedPath = fullPath.replaceAll("//+", "/");
|
||||
String resource = "/WEB-INF/messages/messages_ko.properties";
|
||||
String baseName = StringUtils.substringBeforeLast(resource, ".properties");
|
||||
|
||||
assertAll(
|
||||
() -> assertEquals("/openapi/users", normalizedPath),
|
||||
() -> assertEquals("/openapi", StringUtils.removeEnd("/openapi/", "/")),
|
||||
() -> assertEquals("/openapi", Strings.CS.removeEnd("/openapi/", "/")),
|
||||
() -> assertEquals("/WEB-INF/messages", StringUtils.substringBeforeLast(baseName, "/")),
|
||||
() -> assertEquals("messages_ko", StringUtils.substringAfterLast(baseName, "/")),
|
||||
() -> assertEquals("messages", StringUtils.substringBeforeLast("messages_ko", "_"))
|
||||
|
||||
Reference in New Issue
Block a user