DelegatePropertyAccessor implements PropertyAccessor { @SuppressWarnings("unchecked") public String getSourceAccessor(OgnlContext context, Object target, Object index) { return factory.getPropertyAccessor((String) index, (T) target) .getSourceAccessor(context, target, index); } DelegatePropertyAccessor(PropertyAccessorDelegateFactory<T> factory); @SuppressWarnings("unchecked") Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name); @SuppressWarnings("unchecked") void setProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name,
            Object value); @SuppressWarnings("unchecked") String getSourceAccessor(OgnlContext context, Object target,
            Object index); @SuppressWarnings("unchecked") String getSourceSetter(OgnlContext context, Object target,
            Object index);  }
@SuppressWarnings("unchecked") @Test public void testGetSourceAccessor() { PropertyAccessorDelegateFactory<Integer> factory = createMock(PropertyAccessorDelegateFactory.class); PropertyAccessor mockAccessor = createMock(PropertyAccessor.class); OgnlContext context = createMock(OgnlContext.class); expect(factory.getPropertyAccessor("property", 1)).andReturn(mockAccessor); expect(mockAccessor.getSourceAccessor(context, 1, "property")).andReturn("method"); replay(factory, mockAccessor, context); PropertyAccessor accessor = new DelegatePropertyAccessor<Integer>(factory); assertEquals("method", accessor.getSourceAccessor(context, 1, "property")); verify(factory, mockAccessor, context); }