Skip to content

Commit 40b81fc

Browse files
jhoellerunknown
authored andcommitted
SPR11348 test should use LinkedHashSet since it relies on insertion order of elements
1 parent 241682c commit 40b81fc

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import java.util.Collection;
2525
import java.util.Collections;
2626
import java.util.HashMap;
27-
import java.util.HashSet;
2827
import java.util.LinkedHashMap;
28+
import java.util.LinkedHashSet;
2929
import java.util.List;
3030
import java.util.Map;
3131
import java.util.Properties;
@@ -227,9 +227,7 @@ public int run2() {
227227
public void SPR5804() throws Exception {
228228
Map<String, String> m = new HashMap<String, String>();
229229
m.put("foo", "bar");
230-
StandardEvaluationContext eContext = new StandardEvaluationContext(m); // root is
231-
// a map
232-
// instance
230+
StandardEvaluationContext eContext = new StandardEvaluationContext(m); // root is a map instance
233231
eContext.addPropertyAccessor(new MapAccessor());
234232
Expression expr = new SpelExpressionParser().parseRaw("['foo']");
235233
assertEquals("bar", expr.getValue(eContext));
@@ -419,8 +417,7 @@ public void indexingAsAPropertyAccess_SPR6968_1() {
419417
expr = new SpelExpressionParser().parseRaw("instance[bar]");
420418
name = expr.getValue(eContext, String.class);
421419
assertEquals("hello", name);
422-
name = expr.getValue(eContext, String.class); // will be using the cached accessor
423-
// this time
420+
name = expr.getValue(eContext, String.class); // will be using the cached accessor this time
424421
assertEquals("hello", name);
425422
}
426423

@@ -434,8 +431,7 @@ public void indexingAsAPropertyAccess_SPR6968_2() {
434431
expr = new SpelExpressionParser().parseRaw("instance[#bar]");
435432
name = expr.getValue(eContext, String.class);
436433
assertEquals("hello", name);
437-
name = expr.getValue(eContext, String.class); // will be using the cached accessor
438-
// this time
434+
name = expr.getValue(eContext, String.class); // will be using the cached accessor this time
439435
assertEquals("hello", name);
440436
}
441437

@@ -1279,8 +1275,8 @@ public void customStaticFunctions_SPR9038() {
12791275
@Override
12801276
protected Method[] getMethods(Class<?> type) {
12811277
try {
1282-
return new Method[] { Integer.class.getDeclaredMethod("parseInt", new Class[] { String.class,
1283-
Integer.TYPE }) };
1278+
return new Method[] {
1279+
Integer.class.getDeclaredMethod("parseInt", new Class[] { String.class, Integer.TYPE }) };
12841280
}
12851281
catch (NoSuchMethodException ex) {
12861282
return new Method[0];
@@ -1811,7 +1807,7 @@ public void SPR9194() {
18111807

18121808
@Test
18131809
public void SPR11348() {
1814-
Collection<String> coll = new HashSet<String>();
1810+
Collection<String> coll = new LinkedHashSet<String>();
18151811
coll.add("one");
18161812
coll.add("two");
18171813
coll = Collections.unmodifiableCollection(coll);
@@ -1841,6 +1837,7 @@ public void SPR11445_beanReference() {
18411837
assertEquals(1, expr.getValue(context));
18421838
}
18431839

1840+
18441841
static class Spr11445Class implements BeanResolver {
18451842

18461843
private final AtomicInteger counter = new AtomicInteger();
@@ -1859,6 +1856,7 @@ public Object resolve(EvaluationContext context, String beanName) throws AccessE
18591856
}
18601857
}
18611858

1859+
18621860
@Test
18631861
public void SPR11494() {
18641862
Expression exp = new SpelExpressionParser().parseExpression("T(java.util.Arrays).asList('a','b')");

0 commit comments

Comments
 (0)