This commit is contained in:
looly 2022-01-05 18:51:00 +08:00
parent f8017c31d5
commit 32e0d57ff6

View File

@ -1,5 +1,6 @@
package cn.hutool.json;
import cn.hutool.core.date.LocalDateTimeUtil;
import lombok.Data;
import org.junit.Assert;
import org.junit.Test;
@ -19,10 +20,12 @@ public class Issue644Test {
final JSONObject jsonObject = JSONUtil.parseObj(beanWithDate);
BeanWithDate beanWithDate2 = JSONUtil.toBean(jsonObject, BeanWithDate.class);
Assert.assertEquals(beanWithDate.getDate(), beanWithDate2.getDate());
Assert.assertEquals(LocalDateTimeUtil.formatNormal(beanWithDate.getDate()),
LocalDateTimeUtil.formatNormal(beanWithDate2.getDate()));
beanWithDate2 = JSONUtil.toBean(jsonObject.toString(), BeanWithDate.class);
Assert.assertEquals(beanWithDate.getDate(), beanWithDate2.getDate());
Assert.assertEquals(LocalDateTimeUtil.formatNormal(beanWithDate.getDate()),
LocalDateTimeUtil.formatNormal(beanWithDate2.getDate()));
}
@Data