|
16 | 16 |
|
17 | 17 | package org.springframework.expression.spel;
|
18 | 18 |
|
| 19 | +import java.lang.reflect.Field; |
| 20 | +import java.lang.reflect.Method; |
| 21 | +import java.util.ArrayList; |
| 22 | +import java.util.HashMap; |
| 23 | +import java.util.LinkedHashMap; |
| 24 | +import java.util.List; |
| 25 | +import java.util.Map; |
| 26 | +import java.util.Properties; |
| 27 | + |
19 | 28 | import junit.framework.Assert;
|
| 29 | + |
20 | 30 | import org.junit.Ignore;
|
21 | 31 | import org.junit.Test;
|
| 32 | + |
22 | 33 | import org.springframework.core.convert.TypeDescriptor;
|
23 |
| -import org.springframework.expression.*; |
| 34 | +import org.springframework.expression.AccessException; |
| 35 | +import org.springframework.expression.BeanResolver; |
| 36 | +import org.springframework.expression.EvaluationContext; |
| 37 | +import org.springframework.expression.EvaluationException; |
| 38 | +import org.springframework.expression.Expression; |
| 39 | +import org.springframework.expression.ExpressionParser; |
| 40 | +import org.springframework.expression.MethodExecutor; |
| 41 | +import org.springframework.expression.MethodResolver; |
| 42 | +import org.springframework.expression.ParserContext; |
| 43 | +import org.springframework.expression.PropertyAccessor; |
| 44 | +import org.springframework.expression.TypedValue; |
24 | 45 | import org.springframework.expression.spel.standard.SpelExpression;
|
25 | 46 | import org.springframework.expression.spel.standard.SpelExpressionParser;
|
26 | 47 | import org.springframework.expression.spel.support.ReflectiveMethodResolver;
|
27 | 48 | import org.springframework.expression.spel.support.ReflectivePropertyAccessor;
|
28 | 49 | import org.springframework.expression.spel.support.StandardEvaluationContext;
|
29 | 50 | import org.springframework.expression.spel.support.StandardTypeLocator;
|
| 51 | +import org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver; |
30 | 52 |
|
31 |
| -import java.lang.reflect.Field; |
32 |
| -import java.lang.reflect.Method; |
33 |
| -import java.util.*; |
34 |
| - |
35 |
| -import static org.junit.Assert.assertEquals; |
36 |
| -import static org.junit.Assert.fail; |
| 53 | +import static org.junit.Assert.*; |
37 | 54 |
|
38 | 55 | /**
|
39 |
| - * Tests based on Jiras up to the release of Spring 3.0.0 |
| 56 | + * Reproduction tests cornering various SpEL JIRA issues. |
40 | 57 | *
|
41 | 58 | * @author Andy Clement
|
42 | 59 | * @author Clark Duplichien
|
43 | 60 | */
|
44 |
| -public class SpringEL300Tests extends ExpressionTestCase { |
| 61 | +public class SpelReproTests extends ExpressionTestCase { |
45 | 62 |
|
46 | 63 | @Test
|
47 | 64 | public void testNPE_SPR5661() {
|
@@ -147,12 +164,12 @@ public void testSPR5905_InnerTypeReferences() throws Exception {
|
147 | 164 | Expression expr = new SpelExpressionParser().parseRaw("T(java.util.Map$Entry)");
|
148 | 165 | Assert.assertEquals(Map.Entry.class,expr.getValue(eContext));
|
149 | 166 |
|
150 |
| - expr = new SpelExpressionParser().parseRaw("T(org.springframework.expression.spel.SpringEL300Tests$Outer$Inner).run()"); |
| 167 | + expr = new SpelExpressionParser().parseRaw("T(org.springframework.expression.spel.SpelReproTests$Outer$Inner).run()"); |
151 | 168 | Assert.assertEquals(12,expr.getValue(eContext));
|
152 | 169 |
|
153 |
| - expr = new SpelExpressionParser().parseRaw("new org.springframework.expression.spel.SpringEL300Tests$Outer$Inner().run2()"); |
| 170 | + expr = new SpelExpressionParser().parseRaw("new org.springframework.expression.spel.SpelReproTests$Outer$Inner().run2()"); |
154 | 171 | Assert.assertEquals(13,expr.getValue(eContext));
|
155 |
| -} |
| 172 | + } |
156 | 173 |
|
157 | 174 | static class Outer {
|
158 | 175 | static class Inner {
|
@@ -1034,6 +1051,15 @@ public Reserver getReserver() {
|
1034 | 1051 | Assert.assertEquals("abc",exp.getValue(ctx));
|
1035 | 1052 | }
|
1036 | 1053 |
|
| 1054 | + @Test |
| 1055 | + public void testReservedWordProperties_9862() throws Exception { |
| 1056 | + StandardEvaluationContext ctx = new StandardEvaluationContext(); |
| 1057 | + SpelExpressionParser parser = new SpelExpressionParser(); |
| 1058 | + SpelExpression expression = parser.parseRaw("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST"); |
| 1059 | + Object value = expression.getValue(ctx); |
| 1060 | + assertEquals(value, Reserver.CONST); |
| 1061 | + } |
| 1062 | + |
1037 | 1063 | /**
|
1038 | 1064 | * We add property accessors in the order:
|
1039 | 1065 | * First, Second, Third, Fourth.
|
|
0 commit comments