ReflectiveMethodExecutor invokes interface method if possible

Issue: SPR-16845
This commit is contained in:
Juergen Hoeller
2018-07-19 16:35:59 +02:00
parent 478d7255d2
commit c4df335a1d
4 changed files with 67 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.springframework.expression.spel;
import org.junit.Before;
import org.junit.Test;
import org.springframework.expression.Expression;
@@ -36,17 +35,11 @@ public class CachedMethodExecutorTests {
private final ExpressionParser parser = new SpelExpressionParser();
private StandardEvaluationContext context;
@Before
public void setUp() throws Exception {
this.context = new StandardEvaluationContext(new RootObject());
}
private final StandardEvaluationContext context = new StandardEvaluationContext(new RootObject());
@Test
public void testCachedExecutionForParameters() throws Exception {
public void testCachedExecutionForParameters() {
Expression expression = this.parser.parseExpression("echo(#var)");
assertMethodExecution(expression, 42, "int: 42");
@@ -56,7 +49,7 @@ public class CachedMethodExecutorTests {
}
@Test
public void testCachedExecutionForTarget() throws Exception {
public void testCachedExecutionForTarget() {
Expression expression = this.parser.parseExpression("#var.echo(42)");
assertMethodExecution(expression, new RootObject(), "int: 42");
@@ -76,7 +69,6 @@ public class CachedMethodExecutorTests {
public String echo(String value) {
return "String: " + value;
}
}
public static class RootObject extends BaseObject {
@@ -84,7 +76,6 @@ public class CachedMethodExecutorTests {
public String echo(int value) {
return "int: " + value;
}
}
}