use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testSetConstrained_true.
public void testSetConstrained_true() 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(true);
assertTrue(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 testSetBound_true.
public void testSetBound_true() 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.setBound(true);
assertTrue(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 testPropertyDescriptorStringClassStringString_ReadMethodInvalid.
public void testPropertyDescriptorStringClassStringString_ReadMethodInvalid() throws IntrospectionException {
String propertyName = "booleanProperty";
Class<MockJavaBean> beanClass = MockJavaBean.class;
PropertyDescriptor pd = new PropertyDescriptor(propertyName, beanClass, "getXX", "set" + propertyName);
assertEquals("getBooleanProperty", pd.getReadMethod().getName());
assertEquals("setbooleanProperty", pd.getWriteMethod().getName());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testEquals_ReadMethod_Null.
public void testEquals_ReadMethod_Null() throws IntrospectionException, SecurityException, NoSuchMethodException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method readMethod = null;
PropertyDescriptor pd = new PropertyDescriptor(propertyName, readMethod, null);
String propertyName2 = "PropertyThree";
Method readMethod2 = beanClass.getMethod("get" + propertyName2, (Class[]) null);
PropertyDescriptor pd2 = new PropertyDescriptor(propertyName2, readMethod2, null);
assertFalse(pd.equals(pd2));
}
Aggregations