use of org.apache.harmony.beans.tests.support.mock.FakeFox in project j2objc by google.
the class IntrospectorTest method testGetBeanInfoClass_no_BeanInfo.
/*
* Class under test for BeanInfo getBeanInfo(Class) No XXXXBeanInfo + test
* cache info
*/
public void testGetBeanInfoClass_no_BeanInfo() throws IntrospectionException {
Class<FakeFox> beanClass = FakeFox.class;
BeanInfo info = Introspector.getBeanInfo(beanClass);
assertNull(info.getAdditionalBeanInfo());
BeanDescriptor beanDesc = info.getBeanDescriptor();
assertEquals("FakeFox", beanDesc.getName());
assertEquals(0, info.getEventSetDescriptors().length);
assertEquals(-1, info.getDefaultEventIndex());
assertEquals(-1, info.getDefaultPropertyIndex());
MethodDescriptor[] methodDesc = info.getMethodDescriptors();
Method[] methods = beanClass.getMethods();
assertEquals(methods.length, methodDesc.length);
ArrayList<Method> methodList = new ArrayList<Method>();
for (Method element : methods) {
methodList.add(element);
}
for (MethodDescriptor element : methodDesc) {
assertTrue(methodList.contains(element.getMethod()));
}
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(1, propertyDesc.length);
for (PropertyDescriptor element : propertyDesc) {
if (element.getName().equals("class")) {
assertNull(element.getWriteMethod());
assertNotNull(element.getReadMethod());
}
}
BeanInfo cacheInfo = Introspector.getBeanInfo(FakeFox.class);
assertSame(info, cacheInfo);
}
Aggregations