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());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class BeanDescriptorTest method testBeanDescriptorClassClass_CustomizerClassNull.
public void testBeanDescriptorClassClass_CustomizerClassNull() {
String beanName = "BeanDescriptorTest.bean";
MockJavaBean bean = new MockJavaBean(beanName);
Class<? extends MockJavaBean> beanClass = bean.getClass();
Class<?> cusClass = null;
BeanDescriptor bd = new BeanDescriptor(beanClass, cusClass);
assertSame(beanClass, bd.getBeanClass());
assertNull(bd.getCustomizerClass());
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());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class MethodDescriptorTest method testMethodDescriptorMethodParameterDescriptorArray_PDNull.
public void testMethodDescriptorMethodParameterDescriptorArray_PDNull() throws SecurityException, NoSuchMethodException {
String beanName = "MethodDescriptorTest.bean";
MockJavaBean bean = new MockJavaBean(beanName);
Method method = bean.getClass().getMethod("setPropertyOne", new Class[] { String.class });
MethodDescriptor md = new MethodDescriptor(method, null);
assertSame(method, md.getMethod());
assertNull(md.getParameterDescriptors());
assertEquals(method.getName(), md.getDisplayName());
assertEquals(method.getName(), md.getName());
assertEquals(method.getName(), md.getShortDescription());
assertNotNull(md.attributeNames());
assertFalse(md.isExpert());
assertFalse(md.isHidden());
assertFalse(md.isPreferred());
}
use of org.apache.harmony.beans.tests.support.mock.MockJavaBean in project j2objc by google.
the class PropertyDescriptorTest method testPropertyDescriptorStringMethodMethod_ReadMethodInvalid.
public void testPropertyDescriptorStringMethodMethod_ReadMethodInvalid() throws SecurityException, NoSuchMethodException, IntrospectionException {
String propertyName = "PropertyOne";
Class<MockJavaBean> beanClass = MockJavaBean.class;
String anotherProp = "PropertyTwo";
Method readMethod = beanClass.getMethod("get" + anotherProp, (Class[]) null);
Method writeMethod = beanClass.getMethod("set" + propertyName, new Class[] { String.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 testPropertyDescriptorStringMethodMethod.
/*
* Class under test for void PropertyDescriptor(String, Method, Method)
*/
public void testPropertyDescriptorStringMethodMethod() 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 });
PropertyDescriptor pd = new PropertyDescriptor(propertyName, readMethod, writeMethod);
assertEquals(String.class, pd.getPropertyType());
assertEquals("get" + propertyName, pd.getReadMethod().getName());
assertEquals("set" + propertyName, pd.getWriteMethod().getName());
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());
}
Aggregations