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 bb5ac29845..4ced0759aa 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 @@ -24,8 +24,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Properties; @@ -227,9 +227,7 @@ public class SpelReproTests extends AbstractExpressionTests { public void SPR5804() throws Exception { Map m = new HashMap(); m.put("foo", "bar"); - StandardEvaluationContext eContext = new StandardEvaluationContext(m); // root is - // a map - // instance + StandardEvaluationContext eContext = new StandardEvaluationContext(m); // root is a map instance eContext.addPropertyAccessor(new MapAccessor()); Expression expr = new SpelExpressionParser().parseRaw("['foo']"); assertEquals("bar", expr.getValue(eContext)); @@ -419,8 +417,7 @@ public class SpelReproTests extends AbstractExpressionTests { expr = new SpelExpressionParser().parseRaw("instance[bar]"); name = expr.getValue(eContext, String.class); assertEquals("hello", name); - name = expr.getValue(eContext, String.class); // will be using the cached accessor - // this time + name = expr.getValue(eContext, String.class); // will be using the cached accessor this time assertEquals("hello", name); } @@ -434,8 +431,7 @@ public class SpelReproTests extends AbstractExpressionTests { expr = new SpelExpressionParser().parseRaw("instance[#bar]"); name = expr.getValue(eContext, String.class); assertEquals("hello", name); - name = expr.getValue(eContext, String.class); // will be using the cached accessor - // this time + name = expr.getValue(eContext, String.class); // will be using the cached accessor this time assertEquals("hello", name); } @@ -1279,8 +1275,8 @@ public class SpelReproTests extends AbstractExpressionTests { @Override protected Method[] getMethods(Class type) { try { - return new Method[] { Integer.class.getDeclaredMethod("parseInt", new Class[] { String.class, - Integer.TYPE }) }; + return new Method[] { + Integer.class.getDeclaredMethod("parseInt", new Class[] { String.class, Integer.TYPE }) }; } catch (NoSuchMethodException ex) { return new Method[0]; @@ -1811,7 +1807,7 @@ public class SpelReproTests extends AbstractExpressionTests { @Test public void SPR11348() { - Collection coll = new HashSet(); + Collection coll = new LinkedHashSet(); coll.add("one"); coll.add("two"); coll = Collections.unmodifiableCollection(coll); @@ -1841,6 +1837,7 @@ public class SpelReproTests extends AbstractExpressionTests { assertEquals(1, expr.getValue(context)); } + static class Spr11445Class implements BeanResolver { private final AtomicInteger counter = new AtomicInteger(); @@ -1859,6 +1856,7 @@ public class SpelReproTests extends AbstractExpressionTests { } } + @Test public void SPR11494() { Expression exp = new SpelExpressionParser().parseExpression("T(java.util.Arrays).asList('a','b')");