diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java index 67f077f1676..60b93560f84 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/MethodInvocationTests.java @@ -277,14 +277,11 @@ public class MethodInvocationTests extends AbstractExpressionTests { 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; + context.setBeanResolver((context1, beanName) -> { + if ("service".equals(beanName)) { + return service; } + return null; }); Expression expression = parser.parseExpression("@service.handleBytes(#root)"); byte[] outBytes = expression.getValue(context, byte[].class); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java index fdb81dd2b78..d743a1870b1 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java @@ -5156,8 +5156,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests { } private void assertGetValueFail(Expression expression) { - assertThatExceptionOfType(Exception.class).isThrownBy(() -> - expression.getValue()); + assertThatExceptionOfType(Exception.class).isThrownBy(expression::getValue); } private void assertIsCompiled(Expression expression) { diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java index 1257824ed72..ed067be52a3 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java @@ -1326,18 +1326,14 @@ public class SpelReproTests extends AbstractExpressionTests { @Override public MethodExecutor resolve(EvaluationContext context, Object targetObject, String name, List argumentTypes) throws AccessException { - return new MethodExecutor() { - @Override - public TypedValue execute(EvaluationContext context, Object target, Object... arguments) - throws AccessException { - try { - Method method = XYZ.class.getMethod("values"); - Object value = method.invoke(target, arguments); - return new TypedValue(value, new TypeDescriptor(new MethodParameter(method, -1)).narrow(value)); - } - catch (Exception ex) { - throw new AccessException(ex.getMessage(), ex); - } + return (context1, target, arguments) -> { + try { + Method method = XYZ.class.getMethod("values"); + Object value = method.invoke(target, arguments); + return new TypedValue(value, new TypeDescriptor(new MethodParameter(method, -1)).narrow(value)); + } + catch (Exception ex) { + throw new AccessException(ex.getMessage(), ex); } }; } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java index 82f6974c7f0..faa58780037 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java @@ -345,8 +345,7 @@ public class ReflectionHelperTests extends AbstractExpressionTests { assertThat(property.read(ctx, tester, "property").getValue()).isEqualTo("hello"); // cached accessor used assertThat(property.read(ctx, tester, "property").getValue()).isEqualTo("hello"); - assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> - property.getSpecificTargetClasses()); + assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(property::getSpecificTargetClasses); assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> property.write(ctx, tester, "property", null)); @@ -360,8 +359,7 @@ public class ReflectionHelperTests extends AbstractExpressionTests { assertThat(field.read(ctx, tester, "field").getValue()).isEqualTo(3); // cached accessor used assertThat(field.read(ctx, tester, "field").getValue()).isEqualTo(3); - assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> - field.getSpecificTargetClasses()); + assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(field::getSpecificTargetClasses); assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> field.write(ctx, tester, "field", null)); }