use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class IndexedPropertyDescriptorTest method testEquals.
public void testEquals() 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);
IndexedPropertyDescriptor ipd2 = new IndexedPropertyDescriptor(propertyName, beanClass);
assertTrue(ipd.equals(ipd2));
assertTrue(ipd.equals(ipd));
assertTrue(ipd2.equals(ipd));
assertFalse(ipd.equals(null));
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringMethodMethodMethodMethod_IndexedRWNull.
public void testIndexedPropertyDescriptorStringMethodMethodMethodMethod_IndexedRWNull() 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 });
try {
new IndexedPropertyDescriptor(propertyName, readMethod, writeMethod, null, null);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringClassStringStringStringString_ReadMethodNull.
public void testIndexedPropertyDescriptorStringClassStringStringStringString_ReadMethodNull() throws IntrospectionException {
String propertyName = "PropertyFour";
Class<MockJavaBean> beanClass = MockJavaBean.class;
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, beanClass, null, "set" + propertyName, "get" + propertyName, "set" + propertyName);
assertNull(ipd.getReadMethod());
assertNotNull(ipd.getWriteMethod());
assertEquals(String.class, ipd.getIndexedPropertyType());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringClassStringStringStringString_RIndexedRcompatible.
/*
* ReadMethod/IndexedReadMethod incompatible
*
*/
public void testIndexedPropertyDescriptorStringClassStringStringStringString_RIndexedRcompatible() throws IntrospectionException {
String propertyName = "PropertyFour";
String anotherProp = "PropertyFive";
Class<MockJavaBean> beanClass = MockJavaBean.class;
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, beanClass, "get" + propertyName, "set" + propertyName, "get" + anotherProp, "set" + anotherProp);
assertEquals(String.class, ipd.getIndexedPropertyType());
assertEquals(String[].class, ipd.getPropertyType());
assertEquals("set" + anotherProp, ipd.getIndexedWriteMethod().getName());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringClassStringStringStringString_propInvalid.
public void testIndexedPropertyDescriptorStringClassStringStringStringString_propInvalid() throws IntrospectionException {
String propertyName = "PropertyFour";
String invalidProp = "Not a prop";
Class<MockJavaBean> beanClass = MockJavaBean.class;
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(invalidProp, beanClass, "get" + propertyName, "set" + propertyName, "get" + propertyName, "set" + propertyName);
assertEquals(String[].class, ipd.getPropertyType());
assertEquals(String.class, ipd.getIndexedPropertyType());
assertEquals(invalidProp, ipd.getName());
}
Aggregations