mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
修复BeanUtil.copyProperties中mapToMap时key被转为String问题
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package cn.hutool.core.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class Issue3645Test {
|
||||
@Test
|
||||
public void copyPropertiesTest() {
|
||||
User p = new User();
|
||||
p.setUserId(123L);
|
||||
|
||||
Map<Long, User> map = new HashMap<>();
|
||||
map.put(123L,p);
|
||||
|
||||
Map<Long, User> m = new HashMap<>();
|
||||
BeanUtil.copyProperties(map, m);
|
||||
User u = m.get(123L);
|
||||
assertNotNull(u);
|
||||
}
|
||||
|
||||
@Data
|
||||
static class User{
|
||||
private Long userId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user