use of java.beans.IntrospectionException in project j2objc by google.
the class IndexedPropertyDescriptorTest method testSetIndexedWriteMethod_noargs.
/*
* bad arg count
*/
public void testSetIndexedWriteMethod_noargs() throws IntrospectionException, NoSuchMethodException, NoSuchMethodException {
String propertyName = "PropertyFour";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
Method writeMethod = beanClass.getMethod("set" + propertyName, new Class[] { String[].class });
Method indexedReadMethod = beanClass.getMethod("get" + propertyName, new Class[] { Integer.TYPE });
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, readMethod, writeMethod, indexedReadMethod, null);
assertNull(ipd.getIndexedWriteMethod());
try {
ipd.setIndexedWriteMethod(indexedReadMethod);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
use of java.beans.IntrospectionException in project j2objc by google.
the class IndexedPropertyDescriptorTest method testSetIndexedReadMethodFollowANullValue.
public void testSetIndexedReadMethodFollowANullValue() throws Exception {
try {
IndexedPropertyDescriptor i = new IndexedPropertyDescriptor("a", DummyBean.class, "readMethod", "writeMethod", null, "indexedReadMethod");
Method irm = DummyBean.class.getDeclaredMethod("indexedReadMethod", Integer.TYPE);
i.setIndexedReadMethod(irm);
fail("should throw IntrospectionException.");
} catch (IntrospectionException e) {
// expected
}
}
use of java.beans.IntrospectionException in project j2objc by google.
the class IndexedPropertyDescriptorTest method testSetIndexedWriteMethod_badargtype.
/*
* bad arg type
*/
public void testSetIndexedWriteMethod_badargtype() throws IntrospectionException, NoSuchMethodException, NoSuchMethodException {
String propertyName = "PropertyFour";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
Method writeMethod = beanClass.getMethod("set" + propertyName, new Class[] { String[].class });
Method indexedReadMethod = beanClass.getMethod("get" + propertyName, new Class[] { Integer.TYPE });
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, readMethod, writeMethod, indexedReadMethod, null);
assertNull(ipd.getIndexedWriteMethod());
Method badArgType = beanClass.getMethod("set" + propertyName, new Class[] { Integer.TYPE, Integer.TYPE });
try {
ipd.setIndexedWriteMethod(badArgType);
fail("Should throw IntrospectionException");
} catch (IntrospectionException e) {
}
}
use of java.beans.IntrospectionException in project j2objc by google.
the class PropertyDescriptorTest method testPropertyDescriptorStringClassStringString_ReadMethodNull.
public void testPropertyDescriptorStringClassStringString_ReadMethodNull() throws IntrospectionException {
String propertyName = "PropertyTwo";
Class<MockJavaBean> beanClass = MockJavaBean.class;
PropertyDescriptor pd = new PropertyDescriptor(propertyName, beanClass, null, "set" + propertyName);
assertEquals(Integer.class, pd.getPropertyType());
assertNull(pd.getReadMethod());
assertEquals("set" + propertyName, pd.getWriteMethod().getName());
assertFalse(pd.isBound());
assertFalse(pd.isConstrained());
assertEquals(propertyName, pd.getDisplayName());
assertEquals(propertyName, pd.getName());
assertEquals(propertyName, pd.getShortDescription());
assertNotNull(pd.attributeNames());
assertFalse(pd.isExpert());
assertFalse(pd.isHidden());
assertFalse(pd.isPreferred());
try {
pd = new PropertyDescriptor(propertyName, beanClass, "", "set" + propertyName);
fail("should throw exception");
} catch (IntrospectionException e) {
}
}
use of java.beans.IntrospectionException in project j2objc by google.
the class PropertyDescriptorTest method testSetWriteMethod_WriteReadIncompatible.
/**
* write method is incompatible with read method
*/
public void testSetWriteMethod_WriteReadIncompatible() throws SecurityException, NoSuchMethodException, IntrospectionException {
Class<MockJavaBean> beanClass = MockJavaBean.class;
String propertyName = "PropertyOne";
Method readMethod = beanClass.getMethod("get" + "PropertyTwo", (Class[]) null);
Method writeMethod = beanClass.getMethod("set" + propertyName, new Class[] { String.class });
PropertyDescriptor pd = new PropertyDescriptor(propertyName, readMethod, null);
assertNull(pd.getWriteMethod());
try {
pd.setWriteMethod(writeMethod);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
Aggregations