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

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