Authentication userAuthentication = new UsernamePasswordAuthenticationToken("user", "pass",
AuthorityUtils.createAuthorityList("ROLE_USER"));
OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(clientAuthentication, userAuthentication);
FilterInvocation invocation = new FilterInvocation("/foo", "GET");
EvaluationContext context = handler.createEvaluationContext(oAuth2Authentication, invocation);
Expression expression = handler.getExpressionParser().parseExpression(
"#oauth2.hasAnyScope('write') or #oauth2.isUser()");
assertTrue((Boolean) expression.getValue(context));
}