修复JWT自定义时间格式后的时间戳转换问题

This commit is contained in:
Looly
2023-03-03 23:26:59 +08:00
parent 2cdce52d4a
commit 3dfdd86ca0
11 changed files with 101 additions and 15 deletions

View File

@@ -219,14 +219,14 @@ public class JSONObjectTest {
@Test
public void toBeanNullStrTest() {
final JSONObject json = JSONUtil.createObj()//
final JSONObject json = JSONUtil.createObj(JSONConfig.create().setIgnoreError(true))//
.set("strValue", "null")//
.set("intValue", 123)//
// 子对象对应"null"字符串,如果忽略错误,跳过,否则抛出转换异常
.set("beanValue", "null")//
.set("list", JSONUtil.createArray().set("a").set("b"));
final TestBean bean = json.toBean(TestBean.class, true);
final TestBean bean = json.toBean(TestBean.class);
// 当JSON中为字符串"null"时应被当作字符串处理
Assert.assertEquals("null", bean.getStrValue());
// 当JSON中为字符串"null"时Bean中的字段类型不匹配应在ignoreError模式下忽略注入