IsGetBool i = new IsGetBool();
Object value = BeanUtil.getProperty(i, "flag");
assertNotNull(value);
assertTrue((Boolean) value);
ClassDescriptor cd = ClassIntrospector.lookup(IsGetBool.class);
PropertyDescriptor[] propertyDescriptors = cd.getAllPropertyDescriptors();
assertEquals(1, propertyDescriptors.length);
assertEquals("flag", propertyDescriptors[0].getName());
assertEquals("isFlag", propertyDescriptors[0].getReadMethodDescriptor().getMethod().getName());
MethodDescriptor[] mds = cd.getAllMethodDescriptors();
int c = 0;
for (MethodDescriptor md : mds) {
if (md.isPublic()) c++;
}
assertEquals(3, c);
GetIsBool i2 = new GetIsBool();
value = BeanUtil.getProperty(i2, "flag");
assertNotNull(value);
assertTrue((Boolean) value);
cd = ClassIntrospector.lookup(GetIsBool.class);
assertEquals("flag", propertyDescriptors[0].getName());
assertEquals("isFlag", propertyDescriptors[0].getReadMethodDescriptor().getMethod().getName());
mds = cd.getAllMethodDescriptors();
c = 0;
for (MethodDescriptor md : mds) {
if (md.isPublic()) c++;
}
assertEquals(3, c);