ExtendedBeanInfo ignores invalid bean properties (analogous to the JavaBeans Introspector)

Issue: SPR-12434
This commit is contained in:
Juergen Hoeller
2014-11-27 01:41:48 +01:00
parent f44217a0c2
commit eacd4a181f
2 changed files with 36 additions and 6 deletions

View File

@@ -875,6 +875,15 @@ public class ExtendedBeanInfoTests {
}
}
@Test // SPR-12434
public void shouldDetectValidPropertiesAndIgnoreInvalidProperties() throws IntrospectionException {
BeanInfo bi = new ExtendedBeanInfo(Introspector.getBeanInfo(java.awt.Window.class));
assertThat(hasReadMethodForProperty(bi, "locationByPlatform"), is(true));
assertThat(hasWriteMethodForProperty(bi, "locationByPlatform"), is(true));
assertThat(hasIndexedReadMethodForProperty(bi, "locationByPlatform"), is(false));
assertThat(hasIndexedWriteMethodForProperty(bi, "locationByPlatform"), is(false));
}
private boolean hasWriteMethodForProperty(BeanInfo beanInfo, String propertyName) {
for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {