use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringMethodMethodMethodMethod.
/*
* Class under test for void IndexedPropertyDescriptor(String, Method,
* Method, Method, Method)
*/
public void testIndexedPropertyDescriptorStringMethodMethodMethodMethod() throws SecurityException, NoSuchMethodException, IntrospectionException {
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 });
Method indexedWriteMethod = beanClass.getMethod("set" + propertyName, new Class[] { Integer.TYPE, String.class });
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, readMethod, writeMethod, indexedReadMethod, indexedWriteMethod);
assertEquals(readMethod, ipd.getReadMethod());
assertEquals(writeMethod, ipd.getWriteMethod());
assertEquals(indexedReadMethod, ipd.getIndexedReadMethod());
assertEquals(indexedWriteMethod, ipd.getIndexedWriteMethod());
assertEquals(String[].class, ipd.getPropertyType());
assertEquals(String.class, ipd.getIndexedPropertyType());
assertFalse(ipd.isBound());
assertFalse(ipd.isConstrained());
assertEquals(propertyName, ipd.getDisplayName());
assertEquals(propertyName, ipd.getName());
assertEquals(propertyName, ipd.getShortDescription());
assertNotNull(ipd.attributeNames());
assertFalse(ipd.isExpert());
assertFalse(ipd.isHidden());
assertFalse(ipd.isPreferred());
}
use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringMethodMethodMethodMethod_propNull.
/*
* propertyName=null
*/
public void testIndexedPropertyDescriptorStringMethodMethodMethodMethod_propNull() throws SecurityException, NoSuchMethodException, IntrospectionException {
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 });
Method indexedWriteMethod = beanClass.getMethod("set" + propertyName, new Class[] { Integer.TYPE, String.class });
try {
new IndexedPropertyDescriptor(null, readMethod, writeMethod, indexedReadMethod, indexedWriteMethod);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringClassStringStringStringString_RNull.
/**
* index read /read null
*/
public void testIndexedPropertyDescriptorStringClassStringStringStringString_RNull() throws IntrospectionException {
String propertyName = "PropertyFour";
Class<MockJavaBean> beanClass = MockJavaBean.class;
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, beanClass, null, "set" + propertyName, null, "set" + propertyName);
assertEquals(String.class, ipd.getIndexedPropertyType());
assertEquals(String[].class, ipd.getPropertyType());
assertNotNull(ipd.getWriteMethod());
assertNotNull(ipd.getIndexedWriteMethod());
}
use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringClassStringStringStringString_IndexedWriteMethodNull.
public void testIndexedPropertyDescriptorStringClassStringStringStringString_IndexedWriteMethodNull() throws IntrospectionException {
String propertyName = "PropertyFour";
Class<MockJavaBean> beanClass = MockJavaBean.class;
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, beanClass, "get" + propertyName, "set" + propertyName, "get" + propertyName, null);
assertNotNull(ipd.getIndexedReadMethod());
assertNull(ipd.getIndexedWriteMethod());
assertEquals(String.class, ipd.getIndexedPropertyType());
}
use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringMethodMethodMethodMethod_WriteMethodNull.
public void testIndexedPropertyDescriptorStringMethodMethodMethodMethod_WriteMethodNull() throws SecurityException, NoSuchMethodException, IntrospectionException {
String propertyName = "PropertyFour";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
Method indexedReadMethod = beanClass.getMethod("get" + propertyName, new Class[] { Integer.TYPE });
Method indexedWriteMethod = beanClass.getMethod("set" + propertyName, new Class[] { Integer.TYPE, String.class });
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, readMethod, null, indexedReadMethod, indexedWriteMethod);
assertNull(ipd.getWriteMethod());
assertEquals(String[].class, ipd.getPropertyType());
assertEquals(String.class, ipd.getIndexedPropertyType());
}
Aggregations