[SPR-6063] fixed issue with inconsistent views of PropertyDescriptors

This commit is contained in:
Rob Harrop
2009-09-16 09:53:14 +00:00
parent aa08c11976
commit 01fb1825f5
4 changed files with 55 additions and 2 deletions

View File

@@ -249,6 +249,19 @@ public final class BeanUtilsTests {
assertSignatureEquals(desiredMethod, "doSomethingWithAMultiDimensionalArray(java.lang.String[][])");
}
@Test
public void testSPR6063() {
PropertyDescriptor[] descrs = BeanUtils.getPropertyDescriptors(Bean.class);
PropertyDescriptor keyDescr = BeanUtils.getPropertyDescriptor(Bean.class, "value");
assertEquals(String.class, keyDescr.getPropertyType());
for (PropertyDescriptor propertyDescriptor : descrs) {
if (propertyDescriptor.getName().equals(keyDescr.getName())) {
assertEquals(propertyDescriptor.getName() + " has unexpected type", keyDescr.getPropertyType(), propertyDescriptor.getPropertyType());
}
}
}
private void assertSignatureEquals(Method desiredMethod, String signature) {
assertEquals(desiredMethod, BeanUtils.resolveSignature(signature, MethodSignatureBean.class));
}
@@ -330,4 +343,38 @@ public final class BeanUtilsTests {
}
}
private interface MapEntry<K, V> {
K getKey();
void setKey(V value);
V getValue();
void setValue(V value);
}
private static class Bean implements MapEntry<String, String> {
private String key;
private String value;
public String getKey() {
return key;
}
public void setKey(String aKey) {
key = aKey;
}
public String getValue() {
return value;
}
public void setValue(String aValue) {
value = aValue;
}
}
}