This commit is contained in:
+11
-7
@@ -2,19 +2,23 @@ package com.xiaowang.jayucloud.salon.core.modules.user.support;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
class UserProfileFieldSupportTest {
|
class UserProfileFieldSupportTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信号已改为选填:空值与空白统一归一为 null,不再抛出必填异常。
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
void nailArtistWechatIdIsOptional() {
|
void blankWechatIdIsNormalizedToNull() {
|
||||||
assertDoesNotThrow(() -> UserProfileFieldSupport.requireWechatIdForServiceUser(3, null));
|
assertNull(UserProfileFieldSupport.normalizeOptionalText(null));
|
||||||
|
assertNull(UserProfileFieldSupport.normalizeOptionalText(""));
|
||||||
|
assertNull(UserProfileFieldSupport.normalizeOptionalText(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void managerWechatIdRemainsRequired() {
|
void nonBlankWechatIdIsTrimmed() {
|
||||||
assertThrows(IllegalArgumentException.class,
|
assertEquals("wx_123", UserProfileFieldSupport.normalizeOptionalText(" wx_123 "));
|
||||||
() -> UserProfileFieldSupport.requireWechatIdForServiceUser(2, null));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user