added further generic property resolution test

This commit is contained in:
Juergen Hoeller 2009-03-27 17:31:15 +00:00
parent 225eb6bcd9
commit 2e378a8049
1 changed files with 29 additions and 0 deletions

View File

@ -471,6 +471,14 @@ public final class BeanWrapperGenericsTests {
Assert.assertEquals(new Integer(30), gb.getGenericListProperty().get(1).iterator().next()); Assert.assertEquals(new Integer(30), gb.getGenericListProperty().get(1).iterator().next());
} }
@Test
public void testSettingGenericPropertyWithReadOnlyInterface() {
Bar bar = new Bar();
BeanWrapper bw = new BeanWrapperImpl(bar);
bw.setPropertyValue("version", "10");
Assert.assertEquals(10.0, bar.getVersion());
}
private static abstract class BaseGenericCollectionBean { private static abstract class BaseGenericCollectionBean {
@ -565,4 +573,25 @@ public final class BeanWrapperGenericsTests {
} }
public interface Foo {
Number getVersion();
}
public class Bar implements Foo {
private double version;
public Double getVersion() {
return this.version;
}
public void setVersion(Double theDouble) {
this.version = theDouble;
}
}
} }