use of org.springframework.expression.BeanResolver in project spring-framework by spring-projects.
the class MethodInvocationTests method invokeMethodWithoutConversion.
@Test
public void invokeMethodWithoutConversion() throws Exception {
final BytesService service = new BytesService();
byte[] bytes = new byte[100];
StandardEvaluationContext context = new StandardEvaluationContext(bytes);
context.setBeanResolver(new BeanResolver() {
@Override
public Object resolve(EvaluationContext context, String beanName) throws AccessException {
if ("service".equals(beanName)) {
return service;
}
return null;
}
});
Expression expression = parser.parseExpression("@service.handleBytes(#root)");
byte[] outBytes = expression.getValue(context, byte[].class);
assertSame(bytes, outBytes);
}
use of org.springframework.expression.BeanResolver in project spring-security by spring-projects.
the class DelegatingEvaluationContextTests method getBeanResolver.
@Test
public void getBeanResolver() {
BeanResolver expected = mock(BeanResolver.class);
when(this.delegate.getBeanResolver()).thenReturn(expected);
assertThat(this.context.getBeanResolver()).isEqualTo(expected);
}
Aggregations