use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testSetBound_false.
public void testSetBound_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.setBound(false);
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 testSetWriteMethod_Null.
/**
* setWriteMethod(null)
*/
public void testSetWriteMethod_Null() throws SecurityException, NoSuchMethodException, IntrospectionException {
Class<MockJavaBean> beanClass = MockJavaBean.class;
String propertyName = "PropertyOne";
Method writeMethod = beanClass.getMethod("set" + propertyName, new Class[] { String.class });
PropertyDescriptor pd = new PropertyDescriptor(propertyName, null, writeMethod);
assertSame(writeMethod, pd.getWriteMethod());
pd.setWriteMethod(null);
assertNull(pd.getWriteMethod());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testEquals_ReadMethod.
public void testEquals_ReadMethod() throws IntrospectionException, SecurityException, NoSuchMethodException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) 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));
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testSetReadMethod.
public void testSetReadMethod() 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, null, null);
assertNull(pd.getReadMethod());
pd.setReadMethod(readMethod);
assertSame(readMethod, pd.getReadMethod());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testEquals.
public void testEquals() throws IntrospectionException, SecurityException, NoSuchMethodException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
PropertyDescriptor pd = new PropertyDescriptor(propertyName, beanClass);
Method readMethod = beanClass.getMethod("get" + propertyName, (Class[]) null);
Method writeMethod = beanClass.getMethod("set" + propertyName, new Class[] { String.class });
PropertyDescriptor pd2 = new PropertyDescriptor(propertyName, readMethod, writeMethod);
pd.setName("different name");
assertTrue(pd.equals(pd2));
assertTrue(pd.equals(pd));
assertTrue(pd2.equals(pd));
assertFalse(pd.equals(null));
}
Aggregations