Polish contribution
Closes gh-1070
This commit is contained in:
@@ -34,6 +34,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* </ol>
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Sergey Podgurskiy
|
||||
* @since 4.2
|
||||
*/
|
||||
public class MethodBasedEvaluationContext extends StandardEvaluationContext {
|
||||
@@ -89,7 +90,7 @@ public class MethodBasedEvaluationContext extends StandardEvaluationContext {
|
||||
String[] parameterNames = this.paramDiscoverer.getParameterNames(this.method);
|
||||
// save parameter names (if discovered)
|
||||
if (parameterNames != null) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
for (int i = 0; i < this.args.length; i++) {
|
||||
setVariable(parameterNames[i], this.args[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -30,6 +30,7 @@ import static org.junit.Assert.*;
|
||||
* Unit tests for {@link MethodBasedEvaluationContext}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Sergey Podgurskiy
|
||||
*/
|
||||
public class MethodBasedEvaluationContextTests {
|
||||
|
||||
@@ -92,10 +93,11 @@ public class MethodBasedEvaluationContextTests {
|
||||
@Test
|
||||
public void varArgMultiple() {
|
||||
Method method = ReflectionUtils.findMethod(SampleMethods.class, "hello", Boolean.class, String[].class);
|
||||
MethodBasedEvaluationContext context = createEvaluationContext(method, new Object[] {null, new String[]{"hello", "hi"}});
|
||||
MethodBasedEvaluationContext context = createEvaluationContext(method,
|
||||
new Object[] {null, new String[]{"hello", "hi"}});
|
||||
|
||||
assertNull(context.lookupVariable("p0"));
|
||||
assertNotNull(context.lookupVariable("p1"));
|
||||
assertArrayEquals(new String[]{"hello", "hi"}, (String[]) context.lookupVariable("p1"));
|
||||
}
|
||||
|
||||
private MethodBasedEvaluationContext createEvaluationContext(Method method, Object[] args) {
|
||||
@@ -109,9 +111,10 @@ public class MethodBasedEvaluationContextTests {
|
||||
private void hello(String foo, Boolean flag) {
|
||||
}
|
||||
|
||||
private void hello(Boolean flag, String ... vararg){
|
||||
private void hello(Boolean flag, String... vararg){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user