From 2eefae834ad41e980cbeafef1aa9a97b820cf8a3 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Sun, 8 Nov 2026 02:10:34 +0800 Subject: [PATCH] =?UTF-8?q?test(salon):=20=E6=B8=85=E7=90=86=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E5=BF=85=E5=A1=AB=E9=81=97=E7=95=99=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E6=94=B9=E4=B8=BA=E6=A0=A1=E9=AA=8C=E7=A9=BA?= =?UTF-8?q?=E5=80=BC=E5=BD=92=E4=B8=80=E4=B8=BA=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../support/UserProfileFieldSupportTest.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/user/support/UserProfileFieldSupportTest.java b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/user/support/UserProfileFieldSupportTest.java index 40ed6d5c..875e9b9e 100644 --- a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/user/support/UserProfileFieldSupportTest.java +++ b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/user/support/UserProfileFieldSupportTest.java @@ -2,19 +2,23 @@ package com.xiaowang.jayucloud.salon.core.modules.user.support; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; class UserProfileFieldSupportTest { + /** + * 微信号已改为选填:空值与空白统一归一为 null,不再抛出必填异常。 + */ @Test - void nailArtistWechatIdIsOptional() { - assertDoesNotThrow(() -> UserProfileFieldSupport.requireWechatIdForServiceUser(3, null)); + void blankWechatIdIsNormalizedToNull() { + assertNull(UserProfileFieldSupport.normalizeOptionalText(null)); + assertNull(UserProfileFieldSupport.normalizeOptionalText("")); + assertNull(UserProfileFieldSupport.normalizeOptionalText(" ")); } @Test - void managerWechatIdRemainsRequired() { - assertThrows(IllegalArgumentException.class, - () -> UserProfileFieldSupport.requireWechatIdForServiceUser(2, null)); + void nonBlankWechatIdIsTrimmed() { + assertEquals("wx_123", UserProfileFieldSupport.normalizeOptionalText(" wx_123 ")); } }