@SuppressWarnings("unchecked")
@Test
public void testGetSourceAccessor() {

    NestedObjectExtractor<Integer> nestedObjectExtractor = createMock(NestedObjectExtractor.class);
    PropertyAccessor propertyAccessor = createMock(PropertyAccessor.class);
    OgnlContext context = createMock(OgnlContext.class);
    expect(propertyAccessor.getSourceAccessor(context, "nested", "property")).andReturn("method");
    expect(nestedObjectExtractor.getNestedObject(1)).andReturn("nested");
    replay(nestedObjectExtractor, propertyAccessor, context);
    PropertyAccessor accessor = new NestedObjectDelegatePropertyAccessor<Integer>(
            nestedObjectExtractor, propertyAccessor);
    assertEquals("method", accessor.getSourceAccessor(context, 1, "property"));
    verify(nestedObjectExtractor, propertyAccessor, context);
}