use of org.apache.harmony.beans.tests.support.mock.MockJavaBean 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 org.apache.harmony.beans.tests.support.mock.MockJavaBean 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());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class IndexedPropertyDescriptorTest method testEquals_WriteMethodNull.
/*
* write method null.
*/
public void testEquals_WriteMethodNull() throws SecurityException, NoSuchMethodException, IntrospectionException {
String propertyName = "PropertyFour";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
Method writeMethod = 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, writeMethod, indexedReadMethod, indexedWriteMethod);
IndexedPropertyDescriptor ipd2 = new IndexedPropertyDescriptor(propertyName, beanClass);
assertFalse(ipd.equals(ipd2));
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringMethodMethodMethodMethod_IndexedRWIncompatible.
/*
* IndexedRead/IndexedWrite incompatible
*/
public void testIndexedPropertyDescriptorStringMethodMethodMethodMethod_IndexedRWIncompatible() throws SecurityException, NoSuchMethodException, IntrospectionException {
String propertyName = "PropertyFour";
String anotherProp = "PropertyFive";
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" + anotherProp, 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(propertyName, ipd.getName());
assertEquals(String[].class, ipd.getPropertyType());
assertEquals(String.class, ipd.getIndexedPropertyType());
indexedReadMethod = beanClass.getMethod("get" + anotherProp, new Class[] { Integer.TYPE, Integer.TYPE });
try {
new IndexedPropertyDescriptor(propertyName, readMethod, writeMethod, indexedReadMethod, indexedWriteMethod);
fail("should throw IntrosecptionException");
} catch (IntrospectionException e) {
// expected
}
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class IndexedPropertyDescriptorTest method testSetIndexedReadMethod_null.
public void testSetIndexedReadMethod_null() 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);
assertSame(indexedReadMethod, ipd.getIndexedReadMethod());
ipd.setIndexedReadMethod(null);
assertNull(ipd.getIndexedReadMethod());
}
Aggregations