}
@Test
public void appliesConventionMappingToPropertyWithMultipleSetters() throws Exception {
BeanWithVariousGettersAndSetters bean = generator.newInstance(BeanWithVariousGettersAndSetters.class);
new DslObject(bean).getConventionMapping().map("overloaded", new Callable<String>() {
public String call() {
return "conventionValue";
}
});
assertThat(bean.getOverloaded(), equalTo("conventionValue"));
bean.setOverloaded("value");
assertThat(bean.getOverloaded(), equalTo("chars = value"));
bean = generator.newInstance(BeanWithVariousGettersAndSetters.class);
new DslObject(bean).getConventionMapping().map("overloaded", new Callable<String>() {
public String call() {
return "conventionValue";
}
});
assertThat(bean.getOverloaded(), equalTo("conventionValue"));
bean.setOverloaded(12);
assertThat(bean.getOverloaded(), equalTo("number = 12"));
bean = generator.newInstance(BeanWithVariousGettersAndSetters.class);
new DslObject(bean).getConventionMapping().map("overloaded", new Callable<String>() {
public String call() {
return "conventionValue";
}
});