### Question:
PropertyUtils { public static Object getProperty(Object object, String nestedPropertyName) throws CayenneRuntimeException { return accessor(nestedPropertyName).getValue(object); } private  PropertyUtils(); static Accessor accessor(String nestedPropertyName); static Object getProperty(Object object, String nestedPropertyName); static void setProperty(Object object, String nestedPropertyName, Object value); static void installAccessorFactory(AccessorFactory accessorFactory);  }### Answer:
@Test public void testGetProperty() { TstJavaBean o1 = createBean(); assertSame(o1.getByteArrayField(), PropertyUtils.getProperty(o1, "byteArrayField")); assertSame(o1.getIntegerField(), PropertyUtils.getProperty(o1, "integerField")); assertEquals(o1.getIntField(), PropertyUtils.getProperty(o1, "intField")); assertSame(o1.getNumberField(), PropertyUtils.getProperty(o1, "numberField")); assertSame(o1.getObjectField(), PropertyUtils.getProperty(o1, "objectField")); assertSame(o1.getStringField(), PropertyUtils.getProperty(o1, "stringField")); assertEquals(o1.isBooleanField(), PropertyUtils.getProperty(o1, "booleanField")); }
@Test public void testGetProperty_Nested() { TstJavaBean o1 = createBean(); assertNull(PropertyUtils.getProperty(o1, "related.integerField")); TstJavaBean o1related = new TstJavaBean(); o1related.setIntegerField(44); o1.setRelated(o1related); assertEquals(44, PropertyUtils.getProperty(o1, "related.integerField")); }
@Test public void testGetProperty_NestedOuter() { TstJavaBean o1 = createBean(); assertNull(PropertyUtils.getProperty(o1, "related+.integerField")); TstJavaBean o1related = new TstJavaBean(); o1related.setIntegerField(42); o1.setRelated(o1related); assertEquals(42, PropertyUtils.getProperty(o1, "related+.integerField")); }
@Test public void testGetPropertyMap() { Map<String, Object> o1 = createMap(); assertSame(o1.get("byteArrayField"), PropertyUtils.getProperty(o1, "byteArrayField")); assertSame(o1.get("integerField"), PropertyUtils.getProperty(o1, "integerField")); assertEquals(o1.get("intField"), PropertyUtils.getProperty(o1, "intField")); assertSame(o1.get("numberField"), PropertyUtils.getProperty(o1, "numberField")); assertSame(o1.get("objectField"), PropertyUtils.getProperty(o1, "objectField")); assertSame(o1.get("stringField"), PropertyUtils.getProperty(o1, "stringField")); assertEquals(o1.get("booleanField"), PropertyUtils.getProperty(o1, "booleanField")); }