mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix test
This commit is contained in:
parent
a293fd5510
commit
dacf9c80bb
@ -8,20 +8,8 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class Issue2718Test {
|
public class Issue2718Test {
|
||||||
|
|
||||||
@Setter
|
|
||||||
private static class Deployment{
|
|
||||||
public String getResources() {
|
|
||||||
// setIgnoreProperties会被转换为propertiesFilter,这个filter是过滤键和值的,因此会获取源对象的值(调用getXXX方法),然后做判断。因此此方法会被执行
|
|
||||||
return resources;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String resources;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void copyTest(){
|
public void copyToMapTest(){
|
||||||
final Deployment deployment = new Deployment();
|
final Deployment deployment = new Deployment();
|
||||||
deployment.setResources("test");
|
deployment.setResources("test");
|
||||||
final LinkedHashMap<String, Object> target = BeanCopier
|
final LinkedHashMap<String, Object> target = BeanCopier
|
||||||
@ -30,4 +18,26 @@ public class Issue2718Test {
|
|||||||
|
|
||||||
Assert.assertTrue(target.isEmpty());
|
Assert.assertTrue(target.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void copyToBeanTest(){
|
||||||
|
final Deployment deployment = new Deployment();
|
||||||
|
deployment.setResources("test");
|
||||||
|
final Deployment target = BeanCopier
|
||||||
|
.create(deployment, new Deployment(), CopyOptions.create().setIgnoreProperties("resources"))
|
||||||
|
.copy();
|
||||||
|
|
||||||
|
Assert.assertNull(target.resources);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
private static class Deployment{
|
||||||
|
public String getResources() {
|
||||||
|
// setIgnoreProperties会被转换为propertiesFilter,这个filter是过滤键和值的,因此会获取源对象的值(调用getXXX方法),然后做判断。因此此方法会被执行
|
||||||
|
throw new RuntimeException("这个方法不应该被调用");
|
||||||
|
//return resources;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String resources;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user