mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix bug
This commit is contained in:
33
hutool-core/src/test/java/cn/hutool/core/bean/Issue2082Test.java
Executable file
33
hutool-core/src/test/java/cn/hutool/core/bean/Issue2082Test.java
Executable file
@@ -0,0 +1,33 @@
|
||||
package cn.hutool.core.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* https://github.com/dromara/hutool/issues/2082<br>
|
||||
* 当setXXX有重载方法的时候,BeanDesc中会匹配到重载方法,增加类型检查来规避之
|
||||
*/
|
||||
public class Issue2082Test {
|
||||
|
||||
@Test
|
||||
public void toBeanTest() {
|
||||
TestBean2 testBean2 = new TestBean2();
|
||||
TestBean test = BeanUtil.toBean(testBean2, TestBean.class);
|
||||
Assert.assertNull(test.getId());
|
||||
}
|
||||
|
||||
@Data
|
||||
static class TestBean {
|
||||
private Long id;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = Long.valueOf(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
static class TestBean2 {
|
||||
private String id;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user