@Test
public void testSet() throws Throwable {

    TestBean tb = new TestBean();
    ObjectPropertyUtils.setPropertyValue(tb, "rwProp", "foobar");
    assertEquals("foobar", tb.getRwProp());
    ObjectPropertyUtils.setPropertyValue(tb, "woProp", "barbaz");
    assertEquals("barbaz", tb.woProp);
    try {
        ObjectPropertyUtils.setPropertyValue(tb, "roProp", "bazfoo");
        fail("expected exception");
    } catch (Exception E) {
        // OK!
    }
    long now = System.currentTimeMillis();
    ObjectPropertyUtils.setPropertyValue(tb, "dateProp", new java.sql.Date(now));
    assertEquals(now, tb.getDateProp().getTime());
    String dateStr = "01/03/2013";
    ObjectPropertyUtils.setPropertyValue(tb, "dateProp", dateStr);
    Date expectedDate = new SimpleDateFormat("MM/dd/yy").parse(dateStr);
    assertEquals(expectedDate, tb.getDateProp());
}