mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method
This commit is contained in:
@@ -197,6 +197,19 @@ public class BeanUtilTest {
|
||||
Assert.assertEquals("sub名字", map.get("sub_name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beanToMapWithValueEditTest() {
|
||||
SubPerson person = new SubPerson();
|
||||
person.setAge(14);
|
||||
person.setOpenid("11213232");
|
||||
person.setName("测试A11");
|
||||
person.setSubName("sub名字");
|
||||
|
||||
Map<String, Object> map = BeanUtil.beanToMap(person, new LinkedHashMap<>(),
|
||||
CopyOptions.create().setFieldValueEditor((key, value) -> key + "_" + value));
|
||||
Assert.assertEquals("subName_sub名字", map.get("subName"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beanToMapWithAliasTest() {
|
||||
SubPersonWithAlias person = new SubPersonWithAlias();
|
||||
|
Reference in New Issue
Block a user