@SuppressWarnings("unchecked")
@Test
public void testSetProperty() throws OgnlException {

    NestedObjectExtractor<Integer> nestedObjectExtractor = createMock(NestedObjectExtractor.class);
    PropertyAccessor propertyAccessor = createMock(PropertyAccessor.class);
    Map<String, Object> context = createMock(Map.class);
    propertyAccessor.setProperty(context, "nested", "property", "value");
    expect(nestedObjectExtractor.getNestedObject(1)).andReturn("nested");
    replay(nestedObjectExtractor, propertyAccessor, context);
    PropertyAccessor accessor = new NestedObjectDelegatePropertyAccessor<Integer>(
            nestedObjectExtractor, propertyAccessor);
    accessor.setProperty(context, 1, "property", "value");
    verify(nestedObjectExtractor, propertyAccessor, context);
}