1
0
mirror of synced 2026-02-21 11:57:47 +08:00

🔖 AuthUser添加构造函数,支持反序列化。发布1.10.1

This commit is contained in:
yadong.zhang
2019-08-17 16:37:15 +08:00
parent fd183afd4a
commit 10df9f05f3
7 changed files with 47 additions and 11 deletions

View File

@@ -0,0 +1,31 @@
package me.zhyd.oauth.model;
import com.alibaba.fastjson.JSON;
import org.junit.Assert;
import org.junit.Test;
public class AuthUserTest {
@Test
public void serialize() {
AuthUser user = AuthUser.builder()
.nickname("test")
.build();
String json = JSON.toJSONString(user);
Assert.assertEquals(json, "{\"nickname\":\"test\"}");
}
@Test
public void deserialize() {
AuthUser user = AuthUser.builder()
.nickname("test")
.build();
String json = JSON.toJSONString(user);
AuthUser deserializeUser = JSON.parseObject(json, AuthUser.class);
Assert.assertEquals(deserializeUser.getNickname(), "test");
}
}