Converter转换规则变更,空对象、空值转为Bean时,创建默认对象,而非nul

This commit is contained in:
Looly
2024-07-11 12:43:40 +08:00
parent 2b995a5370
commit b2510cf661
4 changed files with 28 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
package cn.hutool.json;
import lombok.Data;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class Issue3649Test {
@Test
public void toEmptyBeanTest() {
final Object bean = JSONUtil.toBean("{}", JSONConfig.create().setIgnoreError(true), EmptyBean.class);
assertEquals(new EmptyBean(), bean);
}
@Data
public static class EmptyBean {}
}