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 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 "));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user