use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testSetConstrained_false.
public void testSetConstrained_false() throws SecurityException, NoSuchMethodException, IntrospectionException {
Class<MockJavaBean> beanClass = MockJavaBean.class;
String propertyName = "PropertyOne";
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
Method writeMethod = beanClass.getMethod("set" + propertyName, new Class[] { String.class });
PropertyDescriptor pd = new PropertyDescriptor(propertyName, readMethod, writeMethod);
pd.setConstrained(false);
assertFalse(pd.isConstrained());
assertFalse(pd.isBound());
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 testSetReadMethod_Null.
public void testSetReadMethod_Null() throws SecurityException, NoSuchMethodException, IntrospectionException {
Class<MockJavaBean> beanClass = MockJavaBean.class;
String propertyName = "PropertyOne";
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
PropertyDescriptor pd = new PropertyDescriptor(propertyName, readMethod, null);
assertSame(readMethod, pd.getReadMethod());
pd.setReadMethod(null);
assertNull(pd.getReadMethod());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testEquals_WriteMethod_Null.
public void testEquals_WriteMethod_Null() throws IntrospectionException, SecurityException, NoSuchMethodException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method writeMethod = null;
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 testSetWriteMethod_Invalid_NoArgs.
/**
* write method without argument
*/
public void testSetWriteMethod_Invalid_NoArgs() throws SecurityException, NoSuchMethodException, IntrospectionException {
Class<MockJavaBean> beanClass = MockJavaBean.class;
String propertyName = "PropertyOne";
Method writeMethod = beanClass.getMethod("get" + "PropertyTwo", (Class[]) null);
PropertyDescriptor pd = new PropertyDescriptor(propertyName, null, null);
assertNull(pd.getWriteMethod());
try {
pd.setWriteMethod(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_withArg.
/**
* String invalidGetMethod(String arg)
*/
public void testSetReadMethod_Invalid_withArg() throws SecurityException, NoSuchMethodException, IntrospectionException {
Class<MockJavaBean> beanClass = MockJavaBean.class;
String propertyName = "PropertyOne";
Method readMethod = beanClass.getMethod("invalidGetMethod", new Class[] { String.class });
PropertyDescriptor pd = new PropertyDescriptor(propertyName, null, null);
assertNull(pd.getReadMethod());
try {
pd.setReadMethod(readMethod);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
Aggregations