BeanPropertyAccessor { public abstract Object getPropertyValue(Object bean, String property) throws NoSuchPropertyException; protected  BeanPropertyAccessor(); static BeanPropertyAccessor forClass(Class<?> clazz); abstract Object getPropertyValue(Object bean, String property); abstract void setPropertyValue(Object bean, String property,
                                          Object value);  }
@Test public void testGetPropertyValue() { MyObject bean = new MyObject ( TEST_PINT, TEST_PDOUBLE, TEST_WINT, TEST_WDOUBLE, TEST_STRING ); BeanPropertyAccessor accessor = BeanPropertyAccessor.forClass(MyObject.class); assertEquals("invalid primitive int", Integer.valueOf(TEST_PINT), accessor.getPropertyValue(bean, "primitiveInt")); assertEquals("invalid primitive double", Double.valueOf(TEST_PDOUBLE), accessor.getPropertyValue(bean, "primitiveDouble")); assertEquals("invalid wrapper int", TEST_WINT, accessor.getPropertyValue(bean, "wrapperInteger")); assertEquals("invalid wrapper double", TEST_WDOUBLE, accessor.getPropertyValue(bean, "wrapperDouble")); assertEquals("invalid string", TEST_STRING, accessor.getPropertyValue(bean, "string")); }