@SuppressWarnings("unchecked") @Test public void testGetProperty() { Request request = createMock(Request.class); Map<String, Object> oneScope = createMock(Map.class); expect(request.getContext("one")).andReturn(oneScope); replay(request); assertEquals(oneScope, accessor.getProperty(null, request, "oneScope")); assertNull(accessor.getProperty(null, request, "whatever")); verify(request); }
@Override public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name) { Request request = (Request) target; String scope = (String) name; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return request.getContext(scopeName); } return null; }
ScopePropertyAccessor implements PropertyAccessor { @Override public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name) { Request request = (Request) target; String scope = (String) name; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return request.getContext(scopeName); } return null; } }
ScopePropertyAccessor implements PropertyAccessor { @Override public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name) { Request request = (Request) target; String scope = (String) name; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return request.getContext(scopeName); } return null; }  }
ScopePropertyAccessor implements PropertyAccessor { @Override public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name) { Request request = (Request) target; String scope = (String) name; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return request.getContext(scopeName); } return null; }  @Override Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name); @Override String getSourceAccessor(OgnlContext context, Object target,
            Object index); @Override String getSourceSetter(OgnlContext context, Object target,
            Object index); @Override void setProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name,
            Object value); }
ScopePropertyAccessor implements PropertyAccessor { @Override public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name) { Request request = (Request) target; String scope = (String) name; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return request.getContext(scopeName); } return null; }  @Override Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name); @Override String getSourceAccessor(OgnlContext context, Object target,
            Object index); @Override String getSourceSetter(OgnlContext context, Object target,
            Object index); @Override void setProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name,
            Object value);  }