mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add test
This commit is contained in:
parent
1542b02771
commit
9027d146a8
@ -577,6 +577,7 @@ public class BeanUtilTest {
|
||||
private String name;
|
||||
private TestPojo2[] testPojo2List;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class TestPojo2{
|
||||
private int age;
|
||||
|
26
hutool-json/src/test/java/cn/hutool/json/IssueI3EGJP.java
Normal file
26
hutool-json/src/test/java/cn/hutool/json/IssueI3EGJP.java
Normal file
@ -0,0 +1,26 @@
|
||||
package cn.hutool.json;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IssueI3EGJP {
|
||||
|
||||
@Test
|
||||
public void hutoolMapToBean() {
|
||||
JSONObject paramJson = new JSONObject();
|
||||
paramJson.set("is_booleana", "1");
|
||||
paramJson.set("is_booleanb", true);
|
||||
ConvertDO convertDO = BeanUtil.toBean(paramJson, ConvertDO.class);
|
||||
|
||||
Assert.assertTrue(convertDO.isBooleana());
|
||||
Assert.assertTrue(convertDO.getIsBooleanb());
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ConvertDO {
|
||||
private boolean isBooleana;
|
||||
private Boolean isBooleanb;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user