修复BeanUtil.copyProperties中mapToMap时key被转为String问题

This commit is contained in:
Looly
2024-07-06 11:36:22 +08:00
parent 1a46b2a39e
commit 48cc7f5b57
3 changed files with 41 additions and 8 deletions

View File

@@ -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;
}
}