DelegatePropertyAccessor implements PropertyAccessor { @SuppressWarnings("unchecked") public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name) throws OgnlException { return factory.getPropertyAccessor((String) name, (T) target).getProperty( context, target, name); } 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 testGetProperty() throws OgnlException { PropertyAccessorDelegateFactory<Integer> factory = createMock(PropertyAccessorDelegateFactory.class); PropertyAccessor mockAccessor = createMock(PropertyAccessor.class); Map<String, Object> context = createMock(Map.class); expect(factory.getPropertyAccessor("property", 1)).andReturn(mockAccessor); expect(mockAccessor.getProperty(context, 1, "property")).andReturn("value"); replay(factory, mockAccessor, context); PropertyAccessor accessor = new DelegatePropertyAccessor<Integer>(factory); assertEquals("value", accessor.getProperty(context, 1, "property")); verify(factory, mockAccessor, context); }