use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testPropertyDescriptorStringMethodMethod_WriteMethodNull.
public void testPropertyDescriptorStringMethodMethod_WriteMethodNull() throws SecurityException, NoSuchMethodException, IntrospectionException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
Method writeMethod = null;
PropertyDescriptor pd = new PropertyDescriptor(propertyName, readMethod, writeMethod);
assertEquals(String.class, pd.getPropertyType());
assertEquals("get" + propertyName, pd.getReadMethod().getName());
assertNull(pd.getWriteMethod());
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());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testEqualsRegression1763.
// Regression test for H-1763
public void testEqualsRegression1763() throws IntrospectionException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
PropertyDescriptor pd = new PropertyDescriptor(propertyName, beanClass);
try {
pd.equals(propertyName);
} catch (ClassCastException e) {
fail("Equals throws ClassCastException");
}
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testEquals_WriteMethod.
public void testEquals_WriteMethod() throws IntrospectionException, SecurityException, NoSuchMethodException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method writeMethod = beanClass.getMethod("set" + propertyName, new Class[] { String.class });
PropertyDescriptor pd = new PropertyDescriptor(propertyName, null, writeMethod);
String propertyName2 = "PropertyThree";
Method writeMethod2 = beanClass.getMethod("set" + propertyName2, new Class[] { String.class });
PropertyDescriptor pd2 = new PropertyDescriptor(propertyName2, null, writeMethod2);
assertFalse(pd.equals(pd2));
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testPropertyDescriptorStringMethodMethod_WriteMethodInvalid.
public void testPropertyDescriptorStringMethodMethod_WriteMethodInvalid() throws SecurityException, NoSuchMethodException, IntrospectionException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
String anotherProp = "PropertyTwo";
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
Method writeMethod = beanClass.getMethod("set" + anotherProp, new Class[] { Integer.class });
try {
new PropertyDescriptor(propertyName, readMethod, writeMethod);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testSetReadMethod_Invalid_returnVoid.
/**
* String invalidGetMethod(String arg)
*/
public void testSetReadMethod_Invalid_returnVoid() throws SecurityException, NoSuchMethodException, IntrospectionException {
Class<MockJavaBean> beanClass = MockJavaBean.class;
String propertyName = "PropertyOne";
Method readMethod = beanClass.getMethod("invalidGetMethod", (Class[]) null);
PropertyDescriptor pd = new PropertyDescriptor(propertyName, null, null);
assertNull(pd.getReadMethod());
try {
pd.setReadMethod(readMethod);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
Aggregations