From 1e7cdf2506414add2cccd7258642bfb4cdc75480 Mon Sep 17 00:00:00 2001 From: le2sky Date: Thu, 28 Sep 2023 02:00:22 +0900 Subject: [PATCH] =?UTF-8?q?refactor=20:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mealkitary/shop/domain/shop/ShopBusinessNumber.kt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mealkitary-domain/src/main/kotlin/com/mealkitary/shop/domain/shop/ShopBusinessNumber.kt b/mealkitary-domain/src/main/kotlin/com/mealkitary/shop/domain/shop/ShopBusinessNumber.kt index 9d83760..14c6de7 100644 --- a/mealkitary-domain/src/main/kotlin/com/mealkitary/shop/domain/shop/ShopBusinessNumber.kt +++ b/mealkitary-domain/src/main/kotlin/com/mealkitary/shop/domain/shop/ShopBusinessNumber.kt @@ -5,7 +5,6 @@ import javax.persistence.Embeddable // TODO : 매번 REGEX 객체를 생성하는 것이 성능에 얼마나 영향을 미치는지 확인하고 개선 private const val BRN_FORMAT = "([0-9]{3})-?([0-9]{2})-?([0-9]{5})" -private const val INVALID_BRN_FORMAT_MESSAGE = "올바른 사업자번호 형식이 아닙니다." @Embeddable class ShopBusinessNumber private constructor( @@ -15,21 +14,14 @@ class ShopBusinessNumber private constructor( companion object { fun from(brn: String): ShopBusinessNumber { - checkIsBrnBlank(brn) checkIsBrnFormat(brn) return ShopBusinessNumber(brn) } - private fun checkIsBrnBlank(brn: String) { - if (brn.isBlank()) { - throw IllegalArgumentException(INVALID_BRN_FORMAT_MESSAGE) - } - } - private fun checkIsBrnFormat(brn: String) { if (!brn.matches(getBRNFormatRegex())) { - throw IllegalArgumentException(INVALID_BRN_FORMAT_MESSAGE) + throw IllegalArgumentException("올바른 사업자번호 형식이 아닙니다.") } }