BeanUtil { public static Object getBeanProperty(Object bean, String property) throws PropertyAccessException { Object value = null; try { value = PropertyUtils.getProperty(bean, property); } catch (IllegalArgumentException e) { throw new PropertyAccessException(e); } catch (IllegalAccessException e) { throw new PropertyAccessException(e); } catch (InvocationTargetException e) { throw new PropertyAccessException(e.getTargetException()); } catch (NoSuchMethodException e) { throw new PropertyAccessException(e); } return value; }  static void setBeanProperty(Object bean, String property,
            Object value); static Object getBeanProperty(Object bean, String property); static Class<?> getBeanPropertyType(Object bean, String property);  }
@Test public void testGetBeanProperty01() throws Exception { BeanUtil_BeanStub01 bean = new BeanUtil_BeanStub01(); try { BeanUtil.getBeanProperty(bean, "param1"); fail(); } catch (PropertyAccessException e) { assertEquals(Exception.class.getName(), e.getCause().getClass() .getName()); } }
@Test public void testGetBeanProperty02() throws Exception { BeanUtil_BeanStub01 bean = new BeanUtil_BeanStub01(); try { BeanUtil.getBeanProperty(bean, "param3"); fail(); } catch (PropertyAccessException e) { assertEquals(NoSuchMethodException.class.getName(), e.getCause() .getClass().getName()); } }
@Test public void testGetBeanProperty03() throws Exception { try { BeanUtil.getBeanProperty(null, "param1"); fail(); } catch (PropertyAccessException e) { assertEquals(IllegalArgumentException.class.getName(), e.getCause() .getClass().getName()); } }
@Test public void testGetBeanProperty04() throws Exception { BeanUtil_BeanStub01 bean = new BeanUtil_BeanStub01(); try { BeanUtil.getBeanProperty(bean, null); fail(); } catch (PropertyAccessException e) { assertEquals(IllegalArgumentException.class.getName(), e.getCause() .getClass().getName()); } }
@Test public void testGetBeanProperty05() throws Exception { BeanUtil_BeanStub01 bean = new BeanUtil_BeanStub01(); bean.setParam2("PARAM2"); assertEquals("PARAM2", BeanUtil.getBeanProperty(bean, "param2")); }
@Test public void testGetBeanProperty06() throws Exception { BeanUtil_BeanStub01 bean = new BeanUtil_BeanStub01(); assertNull(BeanUtil.getBeanProperty(bean, "param2")); }
@Test public void testGetBeanProperty07() throws Exception { BeanUtil_BeanStub01 bean = new BeanUtil_BeanStub01(); try { BeanUtil.getBeanProperty(bean, ""); fail(); } catch (PropertyAccessException e) { assertEquals(NoSuchMethodException.class.getName(), e.getCause() .getClass().getName()); } }