use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testPropertyDescriptorStringMethodMethod_PropertyNameNull.
public void testPropertyDescriptorStringMethodMethod_PropertyNameNull() throws SecurityException, NoSuchMethodException, IntrospectionException {
String propertyName = "PropertyOne";
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 PropertyDescriptor(null, 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 testPropertyDescriptorStringClass_PropertyNameCapital.
public void testPropertyDescriptorStringClass_PropertyNameCapital() throws IntrospectionException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
PropertyDescriptor pd = new PropertyDescriptor(propertyName, beanClass);
assertEquals(propertyName, pd.getName());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testSetWriteMethod_Invalid.
/**
* write method is incompatible with property name (read method is null)
*/
public void testSetWriteMethod_Invalid() throws SecurityException, NoSuchMethodException, IntrospectionException {
Class<MockJavaBean> beanClass = MockJavaBean.class;
String propertyName = "PropertyOne";
Method writeMethod = beanClass.getMethod("set" + "PropertyTwo", new Class[] { Integer.class });
PropertyDescriptor pd = new PropertyDescriptor(propertyName, null, null);
assertNull(pd.getWriteMethod());
pd.setWriteMethod(writeMethod);
assertSame(writeMethod, pd.getWriteMethod());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyVetoExceptionTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
MockJavaBean myBean = new MockJavaBean("Bean_PropertyVetoExceptionTest");
event = new PropertyChangeEvent(myBean, "propertyOne", "value_old", "value_one");
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class BeanDescriptorTest method testBeanDescriptorClass.
/*
* Class under test for void BeanDescriptor(Class)
*/
public void testBeanDescriptorClass() {
String beanName = "BeanDescriptorTest.bean";
MockJavaBean bean = new MockJavaBean(beanName);
Class<? extends MockJavaBean> beanClass = bean.getClass();
BeanDescriptor bd = new BeanDescriptor(beanClass);
assertSame(beanClass, bd.getBeanClass());
String displayName = beanClass.getName().substring(beanClass.getName().lastIndexOf('.') + 1);
assertEquals(displayName, bd.getDisplayName());
assertEquals(displayName, bd.getName());
assertEquals(displayName, bd.getShortDescription());
assertNotNull(bd.attributeNames());
assertFalse(bd.isExpert());
assertFalse(bd.isHidden());
assertFalse(bd.isPreferred());
}
Aggregations