Polishing
This commit is contained in:
parent
1fd5935afa
commit
639d2c6fe7
|
@ -44,7 +44,7 @@ public abstract class AbstractExpressionTests {
|
||||||
|
|
||||||
protected final ExpressionParser parser = new SpelExpressionParser();
|
protected final ExpressionParser parser = new SpelExpressionParser();
|
||||||
|
|
||||||
protected final StandardEvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext();
|
protected final StandardEvaluationContext context = TestScenarioCreator.getTestEvaluationContext();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +63,7 @@ public abstract class AbstractExpressionTests {
|
||||||
SpelUtilities.printAbstractSyntaxTree(System.out, expr);
|
SpelUtilities.printAbstractSyntaxTree(System.out, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object value = expr.getValue(eContext);
|
Object value = expr.getValue(context);
|
||||||
|
|
||||||
// Check the return value
|
// Check the return value
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
@ -95,7 +95,7 @@ public abstract class AbstractExpressionTests {
|
||||||
SpelUtilities.printAbstractSyntaxTree(System.out, expr);
|
SpelUtilities.printAbstractSyntaxTree(System.out, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object value = expr.getValue(eContext, expectedResultType);
|
Object value = expr.getValue(context, expectedResultType);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (expectedValue == null) {
|
if (expectedValue == null) {
|
||||||
return; // no point doing other checks
|
return; // no point doing other checks
|
||||||
|
@ -127,7 +127,7 @@ public abstract class AbstractExpressionTests {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
SpelUtilities.printAbstractSyntaxTree(System.out, expr);
|
SpelUtilities.printAbstractSyntaxTree(System.out, expr);
|
||||||
}
|
}
|
||||||
Object value = expr.getValue(eContext);
|
Object value = expr.getValue(context);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (expectedValue == null) {
|
if (expectedValue == null) {
|
||||||
return; // no point doing other checks
|
return; // no point doing other checks
|
||||||
|
@ -145,7 +145,7 @@ public abstract class AbstractExpressionTests {
|
||||||
assertTrue("Type of the result was not as expected. Expected '" + expectedClassOfResult +
|
assertTrue("Type of the result was not as expected. Expected '" + expectedClassOfResult +
|
||||||
"' but result was of type '" + resultType + "'", expectedClassOfResult.equals(resultType));
|
"' but result was of type '" + resultType + "'", expectedClassOfResult.equals(resultType));
|
||||||
|
|
||||||
boolean isWritable = expr.isWritable(eContext);
|
boolean isWritable = expr.isWritable(context);
|
||||||
if (isWritable != shouldBeWritable) {
|
if (isWritable != shouldBeWritable) {
|
||||||
if (shouldBeWritable)
|
if (shouldBeWritable)
|
||||||
fail("Expected the expression to be writable but it is not");
|
fail("Expected the expression to be writable but it is not");
|
||||||
|
@ -184,10 +184,10 @@ public abstract class AbstractExpressionTests {
|
||||||
fail("Parser returned null for expression");
|
fail("Parser returned null for expression");
|
||||||
}
|
}
|
||||||
if (expectedReturnType != null) {
|
if (expectedReturnType != null) {
|
||||||
expr.getValue(eContext, expectedReturnType);
|
expr.getValue(context, expectedReturnType);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expr.getValue(eContext);
|
expr.getValue(context);
|
||||||
}
|
}
|
||||||
fail("Should have failed with message " + expectedMessage);
|
fail("Should have failed with message " + expectedMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class BooleanExpressionTests extends AbstractExpressionTests {
|
||||||
return targetType.getType() == Boolean.class ? false : null;
|
return targetType.getType() == Boolean.class ? false : null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
eContext.setTypeConverter(new StandardTypeConverter(conversionService));
|
context.setTypeConverter(new StandardTypeConverter(conversionService));
|
||||||
|
|
||||||
evaluate("null or true", Boolean.TRUE, Boolean.class, false);
|
evaluate("null or true", Boolean.TRUE, Boolean.class, false);
|
||||||
evaluate("null and true", Boolean.FALSE, Boolean.class, false);
|
evaluate("null and true", Boolean.FALSE, Boolean.class, false);
|
||||||
|
|
|
@ -359,7 +359,7 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||||
@Test
|
@Test
|
||||||
public void testTernaryOperator04() {
|
public void testTernaryOperator04() {
|
||||||
Expression e = parser.parseExpression("1>2?3:4");
|
Expression e = parser.parseExpression("1>2?3:4");
|
||||||
assertFalse(e.isWritable(eContext));
|
assertFalse(e.isWritable(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -163,9 +163,9 @@ public class MethodInvocationTests extends AbstractExpressionTests {
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
Expression expr = parser.parseExpression("throwException(#bar)");
|
Expression expr = parser.parseExpression("throwException(#bar)");
|
||||||
|
|
||||||
eContext.setVariable("bar", 2);
|
context.setVariable("bar", 2);
|
||||||
try {
|
try {
|
||||||
expr.getValue(eContext);
|
expr.getValue(context);
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
@ -187,9 +187,9 @@ public class MethodInvocationTests extends AbstractExpressionTests {
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
Expression expr = parser.parseExpression("throwException(#bar)");
|
Expression expr = parser.parseExpression("throwException(#bar)");
|
||||||
|
|
||||||
eContext.setVariable("bar", 4);
|
context.setVariable("bar", 4);
|
||||||
try {
|
try {
|
||||||
expr.getValue(eContext);
|
expr.getValue(context);
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
catch (ExpressionInvocationTargetException ex) {
|
catch (ExpressionInvocationTargetException ex) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -102,11 +102,11 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void SPR5899() {
|
public void SPR5899() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new Spr5899Class());
|
StandardEvaluationContext context = new StandardEvaluationContext(new Spr5899Class());
|
||||||
Expression expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull(12)");
|
Expression expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull(12)");
|
||||||
assertEquals(12, expr.getValue(eContext));
|
assertEquals(12, expr.getValue(context));
|
||||||
expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull(null)");
|
expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull(null)");
|
||||||
assertEquals(null, expr.getValue(eContext));
|
assertEquals(null, expr.getValue(context));
|
||||||
try {
|
try {
|
||||||
expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull2(null)");
|
expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull2(null)");
|
||||||
expr.getValue();
|
expr.getValue();
|
||||||
|
@ -115,73 +115,73 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
catch (EvaluationException see) {
|
catch (EvaluationException see) {
|
||||||
// success
|
// success
|
||||||
}
|
}
|
||||||
eContext.setTypeLocator(new MyTypeLocator());
|
context.setTypeLocator(new MyTypeLocator());
|
||||||
|
|
||||||
// varargs
|
// varargs
|
||||||
expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull3(null,'a','b')");
|
expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull3(null,'a','b')");
|
||||||
assertEquals("ab", expr.getValue(eContext));
|
assertEquals("ab", expr.getValue(context));
|
||||||
|
|
||||||
// varargs 2 - null is packed into the varargs
|
// varargs 2 - null is packed into the varargs
|
||||||
expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull3(12,'a',null,'c')");
|
expr = new SpelExpressionParser().parseRaw("tryToInvokeWithNull3(12,'a',null,'c')");
|
||||||
assertEquals("anullc", expr.getValue(eContext));
|
assertEquals("anullc", expr.getValue(context));
|
||||||
|
|
||||||
// check we can find the ctor ok
|
// check we can find the ctor ok
|
||||||
expr = new SpelExpressionParser().parseRaw("new Spr5899Class().toString()");
|
expr = new SpelExpressionParser().parseRaw("new Spr5899Class().toString()");
|
||||||
assertEquals("instance", expr.getValue(eContext));
|
assertEquals("instance", expr.getValue(context));
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("new Spr5899Class(null).toString()");
|
expr = new SpelExpressionParser().parseRaw("new Spr5899Class(null).toString()");
|
||||||
assertEquals("instance", expr.getValue(eContext));
|
assertEquals("instance", expr.getValue(context));
|
||||||
|
|
||||||
// ctor varargs
|
// ctor varargs
|
||||||
expr = new SpelExpressionParser().parseRaw("new Spr5899Class(null,'a','b').toString()");
|
expr = new SpelExpressionParser().parseRaw("new Spr5899Class(null,'a','b').toString()");
|
||||||
assertEquals("instance", expr.getValue(eContext));
|
assertEquals("instance", expr.getValue(context));
|
||||||
|
|
||||||
// ctor varargs 2
|
// ctor varargs 2
|
||||||
expr = new SpelExpressionParser().parseRaw("new Spr5899Class(null,'a', null, 'b').toString()");
|
expr = new SpelExpressionParser().parseRaw("new Spr5899Class(null,'a', null, 'b').toString()");
|
||||||
assertEquals("instance", expr.getValue(eContext));
|
assertEquals("instance", expr.getValue(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void SPR5905_InnerTypeReferences() {
|
public void SPR5905_InnerTypeReferences() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new Spr5899Class());
|
StandardEvaluationContext context = new StandardEvaluationContext(new Spr5899Class());
|
||||||
Expression expr = new SpelExpressionParser().parseRaw("T(java.util.Map$Entry)");
|
Expression expr = new SpelExpressionParser().parseRaw("T(java.util.Map$Entry)");
|
||||||
assertEquals(Map.Entry.class, expr.getValue(eContext));
|
assertEquals(Map.Entry.class, expr.getValue(context));
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("T(org.springframework.expression.spel.SpelReproTests$Outer$Inner).run()");
|
expr = new SpelExpressionParser().parseRaw("T(org.springframework.expression.spel.SpelReproTests$Outer$Inner).run()");
|
||||||
assertEquals(12, expr.getValue(eContext));
|
assertEquals(12, expr.getValue(context));
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("new org.springframework.expression.spel.SpelReproTests$Outer$Inner().run2()");
|
expr = new SpelExpressionParser().parseRaw("new org.springframework.expression.spel.SpelReproTests$Outer$Inner().run2()");
|
||||||
assertEquals(13, expr.getValue(eContext));
|
assertEquals(13, expr.getValue(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void SPR5804() {
|
public void SPR5804() {
|
||||||
Map<String, String> m = new HashMap<>();
|
Map<String, String> m = new HashMap<>();
|
||||||
m.put("foo", "bar");
|
m.put("foo", "bar");
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(m); // root is a map instance
|
StandardEvaluationContext context = new StandardEvaluationContext(m); // root is a map instance
|
||||||
eContext.addPropertyAccessor(new MapAccessor());
|
context.addPropertyAccessor(new MapAccessor());
|
||||||
Expression expr = new SpelExpressionParser().parseRaw("['foo']");
|
Expression expr = new SpelExpressionParser().parseRaw("['foo']");
|
||||||
assertEquals("bar", expr.getValue(eContext));
|
assertEquals("bar", expr.getValue(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void SPR5847() {
|
public void SPR5847() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new TestProperties());
|
StandardEvaluationContext context = new StandardEvaluationContext(new TestProperties());
|
||||||
String name = null;
|
String name = null;
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("jdbcProperties['username']");
|
expr = new SpelExpressionParser().parseRaw("jdbcProperties['username']");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("Dave", name);
|
assertEquals("Dave", name);
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("jdbcProperties[username]");
|
expr = new SpelExpressionParser().parseRaw("jdbcProperties[username]");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("Dave", name);
|
assertEquals("Dave", name);
|
||||||
|
|
||||||
// MapAccessor required for this to work
|
// MapAccessor required for this to work
|
||||||
expr = new SpelExpressionParser().parseRaw("jdbcProperties.username");
|
expr = new SpelExpressionParser().parseRaw("jdbcProperties.username");
|
||||||
eContext.addPropertyAccessor(new MapAccessor());
|
context.addPropertyAccessor(new MapAccessor());
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("Dave", name);
|
assertEquals("Dave", name);
|
||||||
|
|
||||||
// --- dotted property names
|
// --- dotted property names
|
||||||
|
@ -189,14 +189,14 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
// lookup foo on the root, then bar on that, then use that as the key into
|
// lookup foo on the root, then bar on that, then use that as the key into
|
||||||
// jdbcProperties
|
// jdbcProperties
|
||||||
expr = new SpelExpressionParser().parseRaw("jdbcProperties[foo.bar]");
|
expr = new SpelExpressionParser().parseRaw("jdbcProperties[foo.bar]");
|
||||||
eContext.addPropertyAccessor(new MapAccessor());
|
context.addPropertyAccessor(new MapAccessor());
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("Dave2", name);
|
assertEquals("Dave2", name);
|
||||||
|
|
||||||
// key is foo.bar
|
// key is foo.bar
|
||||||
expr = new SpelExpressionParser().parseRaw("jdbcProperties['foo.bar']");
|
expr = new SpelExpressionParser().parseRaw("jdbcProperties['foo.bar']");
|
||||||
eContext.addPropertyAccessor(new MapAccessor());
|
context.addPropertyAccessor(new MapAccessor());
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("Elephant", name);
|
assertEquals("Elephant", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,13 +237,13 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void accessingNullPropertyViaReflection_SPR5663() throws AccessException {
|
public void accessingNullPropertyViaReflection_SPR5663() throws AccessException {
|
||||||
PropertyAccessor propertyAccessor = new ReflectivePropertyAccessor();
|
PropertyAccessor accessor = new ReflectivePropertyAccessor();
|
||||||
EvaluationContext context = TestScenarioCreator.getTestEvaluationContext();
|
EvaluationContext context = TestScenarioCreator.getTestEvaluationContext();
|
||||||
assertFalse(propertyAccessor.canRead(context, null, "abc"));
|
assertFalse(accessor.canRead(context, null, "abc"));
|
||||||
assertFalse(propertyAccessor.canWrite(context, null, "abc"));
|
assertFalse(accessor.canWrite(context, null, "abc"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
propertyAccessor.read(context, null, "abc");
|
accessor.read(context, null, "abc");
|
||||||
fail("Should have failed with an IllegalStateException");
|
fail("Should have failed with an IllegalStateException");
|
||||||
}
|
}
|
||||||
catch (IllegalStateException ex) {
|
catch (IllegalStateException ex) {
|
||||||
|
@ -251,7 +251,7 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
propertyAccessor.write(context, null, "abc", "foo");
|
accessor.write(context, null, "abc", "foo");
|
||||||
fail("Should have failed with an IllegalStateException");
|
fail("Should have failed with an IllegalStateException");
|
||||||
}
|
}
|
||||||
catch (IllegalStateException ex) {
|
catch (IllegalStateException ex) {
|
||||||
|
@ -261,36 +261,36 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void nestedProperties_SPR6923() {
|
public void nestedProperties_SPR6923() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new Foo());
|
StandardEvaluationContext context = new StandardEvaluationContext(new Foo());
|
||||||
Expression expr = new SpelExpressionParser().parseRaw("resource.resource.server");
|
Expression expr = new SpelExpressionParser().parseRaw("resource.resource.server");
|
||||||
String name = expr.getValue(eContext, String.class);
|
String name = expr.getValue(context, String.class);
|
||||||
assertEquals("abc", name);
|
assertEquals("abc", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Should be accessing Goo.getKey because 'bar' field evaluates to "key" */
|
/** Should be accessing Goo.getKey because 'bar' field evaluates to "key" */
|
||||||
@Test
|
@Test
|
||||||
public void indexingAsAPropertyAccess_SPR6968_1() {
|
public void indexingAsAPropertyAccess_SPR6968_1() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new Goo());
|
StandardEvaluationContext context = new StandardEvaluationContext(new Goo());
|
||||||
String name = null;
|
String name = null;
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
expr = new SpelExpressionParser().parseRaw("instance[bar]");
|
expr = new SpelExpressionParser().parseRaw("instance[bar]");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("hello", name);
|
assertEquals("hello", name);
|
||||||
name = expr.getValue(eContext, String.class); // will be using the cached accessor this time
|
name = expr.getValue(context, String.class); // will be using the cached accessor this time
|
||||||
assertEquals("hello", name);
|
assertEquals("hello", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Should be accessing Goo.getKey because 'bar' variable evaluates to "key" */
|
/** Should be accessing Goo.getKey because 'bar' variable evaluates to "key" */
|
||||||
@Test
|
@Test
|
||||||
public void indexingAsAPropertyAccess_SPR6968_2() {
|
public void indexingAsAPropertyAccess_SPR6968_2() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new Goo());
|
StandardEvaluationContext context = new StandardEvaluationContext(new Goo());
|
||||||
eContext.setVariable("bar", "key");
|
context.setVariable("bar", "key");
|
||||||
String name = null;
|
String name = null;
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
expr = new SpelExpressionParser().parseRaw("instance[#bar]");
|
expr = new SpelExpressionParser().parseRaw("instance[#bar]");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("hello", name);
|
assertEquals("hello", name);
|
||||||
name = expr.getValue(eContext, String.class); // will be using the cached accessor this time
|
name = expr.getValue(context, String.class); // will be using the cached accessor this time
|
||||||
assertEquals("hello", name);
|
assertEquals("hello", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,8 +298,8 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
@Test
|
@Test
|
||||||
public void dollarPrefixedIdentifier_SPR7100() {
|
public void dollarPrefixedIdentifier_SPR7100() {
|
||||||
Holder h = new Holder();
|
Holder h = new Holder();
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(h);
|
StandardEvaluationContext context = new StandardEvaluationContext(h);
|
||||||
eContext.addPropertyAccessor(new MapAccessor());
|
context.addPropertyAccessor(new MapAccessor());
|
||||||
h.map.put("$foo", "wibble");
|
h.map.put("$foo", "wibble");
|
||||||
h.map.put("foo$bar", "wobble");
|
h.map.put("foo$bar", "wobble");
|
||||||
h.map.put("foobar$$", "wabble");
|
h.map.put("foobar$$", "wabble");
|
||||||
|
@ -310,42 +310,42 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("map.$foo");
|
expr = new SpelExpressionParser().parseRaw("map.$foo");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("wibble", name);
|
assertEquals("wibble", name);
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("map.foo$bar");
|
expr = new SpelExpressionParser().parseRaw("map.foo$bar");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("wobble", name);
|
assertEquals("wobble", name);
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("map.foobar$$");
|
expr = new SpelExpressionParser().parseRaw("map.foobar$$");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("wabble", name);
|
assertEquals("wabble", name);
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("map.$");
|
expr = new SpelExpressionParser().parseRaw("map.$");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("wubble", name);
|
assertEquals("wubble", name);
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("map.$$");
|
expr = new SpelExpressionParser().parseRaw("map.$$");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("webble", name);
|
assertEquals("webble", name);
|
||||||
|
|
||||||
expr = new SpelExpressionParser().parseRaw("map.$_$");
|
expr = new SpelExpressionParser().parseRaw("map.$_$");
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("tribble", name);
|
assertEquals("tribble", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Should be accessing Goo.wibble field because 'bar' variable evaluates to "wibble" */
|
/** Should be accessing Goo.wibble field because 'bar' variable evaluates to "wibble" */
|
||||||
@Test
|
@Test
|
||||||
public void indexingAsAPropertyAccess_SPR6968_3() {
|
public void indexingAsAPropertyAccess_SPR6968_3() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new Goo());
|
StandardEvaluationContext context = new StandardEvaluationContext(new Goo());
|
||||||
eContext.setVariable("bar", "wibble");
|
context.setVariable("bar", "wibble");
|
||||||
String name = null;
|
String name = null;
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
expr = new SpelExpressionParser().parseRaw("instance[#bar]");
|
expr = new SpelExpressionParser().parseRaw("instance[#bar]");
|
||||||
// will access the field 'wibble' and not use a getter
|
// will access the field 'wibble' and not use a getter
|
||||||
name = expr.getValue(eContext, String.class);
|
name = expr.getValue(context, String.class);
|
||||||
assertEquals("wobble", name);
|
assertEquals("wobble", name);
|
||||||
name = expr.getValue(eContext, String.class); // will be using the cached accessor this time
|
name = expr.getValue(context, String.class); // will be using the cached accessor this time
|
||||||
assertEquals("wobble", name);
|
assertEquals("wobble", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,14 +356,14 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
@Test
|
@Test
|
||||||
public void indexingAsAPropertyAccess_SPR6968_4() {
|
public void indexingAsAPropertyAccess_SPR6968_4() {
|
||||||
Goo g = Goo.instance;
|
Goo g = Goo.instance;
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(g);
|
StandardEvaluationContext context = new StandardEvaluationContext(g);
|
||||||
eContext.setVariable("bar", "wibble");
|
context.setVariable("bar", "wibble");
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
expr = new SpelExpressionParser().parseRaw("instance[#bar]='world'");
|
expr = new SpelExpressionParser().parseRaw("instance[#bar]='world'");
|
||||||
// will access the field 'wibble' and not use a getter
|
// will access the field 'wibble' and not use a getter
|
||||||
expr.getValue(eContext, String.class);
|
expr.getValue(context, String.class);
|
||||||
assertEquals("world", g.wibble);
|
assertEquals("world", g.wibble);
|
||||||
expr.getValue(eContext, String.class); // will be using the cached accessor this time
|
expr.getValue(context, String.class); // will be using the cached accessor this time
|
||||||
assertEquals("world", g.wibble);
|
assertEquals("world", g.wibble);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,31 +371,31 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
@Test
|
@Test
|
||||||
public void indexingAsAPropertyAccess_SPR6968_5() {
|
public void indexingAsAPropertyAccess_SPR6968_5() {
|
||||||
Goo g = Goo.instance;
|
Goo g = Goo.instance;
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(g);
|
StandardEvaluationContext context = new StandardEvaluationContext(g);
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
expr = new SpelExpressionParser().parseRaw("instance[bar]='world'");
|
expr = new SpelExpressionParser().parseRaw("instance[bar]='world'");
|
||||||
expr.getValue(eContext, String.class);
|
expr.getValue(context, String.class);
|
||||||
assertEquals("world", g.value);
|
assertEquals("world", g.value);
|
||||||
expr.getValue(eContext, String.class); // will be using the cached accessor this time
|
expr.getValue(context, String.class); // will be using the cached accessor this time
|
||||||
assertEquals("world", g.value);
|
assertEquals("world", g.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void dollars() {
|
public void dollars() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new XX());
|
StandardEvaluationContext context = new StandardEvaluationContext(new XX());
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
expr = new SpelExpressionParser().parseRaw("m['$foo']");
|
expr = new SpelExpressionParser().parseRaw("m['$foo']");
|
||||||
eContext.setVariable("file_name", "$foo");
|
context.setVariable("file_name", "$foo");
|
||||||
assertEquals("wibble", expr.getValue(eContext, String.class));
|
assertEquals("wibble", expr.getValue(context, String.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void dollars2() {
|
public void dollars2() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new XX());
|
StandardEvaluationContext context = new StandardEvaluationContext(new XX());
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
expr = new SpelExpressionParser().parseRaw("m[$foo]");
|
expr = new SpelExpressionParser().parseRaw("m[$foo]");
|
||||||
eContext.setVariable("file_name", "$foo");
|
context.setVariable("file_name", "$foo");
|
||||||
assertEquals("wibble", expr.getValue(eContext, String.class));
|
assertEquals("wibble", expr.getValue(context, String.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTemplateParsing(String expression, String expectedValue) {
|
private void checkTemplateParsing(String expression, String expectedValue) {
|
||||||
|
@ -448,33 +448,33 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void beanResolution() {
|
public void beanResolution() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new XX());
|
StandardEvaluationContext context = new StandardEvaluationContext(new XX());
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
|
|
||||||
// no resolver registered == exception
|
// no resolver registered == exception
|
||||||
try {
|
try {
|
||||||
expr = new SpelExpressionParser().parseRaw("@foo");
|
expr = new SpelExpressionParser().parseRaw("@foo");
|
||||||
assertEquals("custard", expr.getValue(eContext, String.class));
|
assertEquals("custard", expr.getValue(context, String.class));
|
||||||
}
|
}
|
||||||
catch (SpelEvaluationException see) {
|
catch (SpelEvaluationException see) {
|
||||||
assertEquals(SpelMessage.NO_BEAN_RESOLVER_REGISTERED, see.getMessageCode());
|
assertEquals(SpelMessage.NO_BEAN_RESOLVER_REGISTERED, see.getMessageCode());
|
||||||
assertEquals("foo", see.getInserts()[0]);
|
assertEquals("foo", see.getInserts()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
eContext.setBeanResolver(new MyBeanResolver());
|
context.setBeanResolver(new MyBeanResolver());
|
||||||
|
|
||||||
// bean exists
|
// bean exists
|
||||||
expr = new SpelExpressionParser().parseRaw("@foo");
|
expr = new SpelExpressionParser().parseRaw("@foo");
|
||||||
assertEquals("custard", expr.getValue(eContext, String.class));
|
assertEquals("custard", expr.getValue(context, String.class));
|
||||||
|
|
||||||
// bean does not exist
|
// bean does not exist
|
||||||
expr = new SpelExpressionParser().parseRaw("@bar");
|
expr = new SpelExpressionParser().parseRaw("@bar");
|
||||||
assertEquals(null, expr.getValue(eContext, String.class));
|
assertEquals(null, expr.getValue(context, String.class));
|
||||||
|
|
||||||
// bean name will cause AccessException
|
// bean name will cause AccessException
|
||||||
expr = new SpelExpressionParser().parseRaw("@goo");
|
expr = new SpelExpressionParser().parseRaw("@goo");
|
||||||
try {
|
try {
|
||||||
assertEquals(null, expr.getValue(eContext, String.class));
|
assertEquals(null, expr.getValue(context, String.class));
|
||||||
}
|
}
|
||||||
catch (SpelEvaluationException see) {
|
catch (SpelEvaluationException see) {
|
||||||
assertEquals(SpelMessage.EXCEPTION_DURING_BEAN_RESOLUTION, see.getMessageCode());
|
assertEquals(SpelMessage.EXCEPTION_DURING_BEAN_RESOLUTION, see.getMessageCode());
|
||||||
|
@ -485,12 +485,12 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
|
|
||||||
// bean exists
|
// bean exists
|
||||||
expr = new SpelExpressionParser().parseRaw("@'foo.bar'");
|
expr = new SpelExpressionParser().parseRaw("@'foo.bar'");
|
||||||
assertEquals("trouble", expr.getValue(eContext, String.class));
|
assertEquals("trouble", expr.getValue(context, String.class));
|
||||||
|
|
||||||
// bean exists
|
// bean exists
|
||||||
try {
|
try {
|
||||||
expr = new SpelExpressionParser().parseRaw("@378");
|
expr = new SpelExpressionParser().parseRaw("@378");
|
||||||
assertEquals("trouble", expr.getValue(eContext, String.class));
|
assertEquals("trouble", expr.getValue(context, String.class));
|
||||||
}
|
}
|
||||||
catch (SpelParseException spe) {
|
catch (SpelParseException spe) {
|
||||||
assertEquals(SpelMessage.INVALID_BEAN_REFERENCE, spe.getMessageCode());
|
assertEquals(SpelMessage.INVALID_BEAN_REFERENCE, spe.getMessageCode());
|
||||||
|
@ -499,7 +499,7 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void elvis_SPR7209_1() {
|
public void elvis_SPR7209_1() {
|
||||||
StandardEvaluationContext eContext = new StandardEvaluationContext(new XX());
|
StandardEvaluationContext context = new StandardEvaluationContext(new XX());
|
||||||
Expression expr = null;
|
Expression expr = null;
|
||||||
|
|
||||||
// Different parts of elvis expression are null
|
// Different parts of elvis expression are null
|
||||||
|
@ -513,7 +513,7 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
// Different parts of ternary expression are null
|
// Different parts of ternary expression are null
|
||||||
try {
|
try {
|
||||||
expr = new SpelExpressionParser().parseRaw("(?'abc':'default')");
|
expr = new SpelExpressionParser().parseRaw("(?'abc':'default')");
|
||||||
expr.getValue(eContext);
|
expr.getValue(context);
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
catch (SpelEvaluationException see) {
|
catch (SpelEvaluationException see) {
|
||||||
|
@ -525,7 +525,7 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
// Assignment
|
// Assignment
|
||||||
try {
|
try {
|
||||||
expr = new SpelExpressionParser().parseRaw("(='default')");
|
expr = new SpelExpressionParser().parseRaw("(='default')");
|
||||||
expr.getValue(eContext);
|
expr.getValue(context);
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
catch (SpelEvaluationException see) {
|
catch (SpelEvaluationException see) {
|
||||||
|
@ -553,55 +553,55 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
nameMap.put("givenName", "Arthur");
|
nameMap.put("givenName", "Arthur");
|
||||||
map.put("value", nameMap);
|
map.put("value", nameMap);
|
||||||
|
|
||||||
StandardEvaluationContext ctx = new StandardEvaluationContext(map);
|
StandardEvaluationContext context = new StandardEvaluationContext(map);
|
||||||
ExpressionParser parser = new SpelExpressionParser();
|
ExpressionParser parser = new SpelExpressionParser();
|
||||||
String el1 = "#root['value'].get('givenName')";
|
String el1 = "#root['value'].get('givenName')";
|
||||||
Expression exp = parser.parseExpression(el1);
|
Expression exp = parser.parseExpression(el1);
|
||||||
Object evaluated = exp.getValue(ctx);
|
Object evaluated = exp.getValue(context);
|
||||||
assertEquals("Arthur", evaluated);
|
assertEquals("Arthur", evaluated);
|
||||||
|
|
||||||
String el2 = "#root['value']['givenName']";
|
String el2 = "#root['value']['givenName']";
|
||||||
exp = parser.parseExpression(el2);
|
exp = parser.parseExpression(el2);
|
||||||
evaluated = exp.getValue(ctx);
|
evaluated = exp.getValue(context);
|
||||||
assertEquals("Arthur", evaluated);
|
assertEquals("Arthur", evaluated);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void projectionTypeDescriptors_1() {
|
public void projectionTypeDescriptors_1() {
|
||||||
StandardEvaluationContext ctx = new StandardEvaluationContext(new C());
|
StandardEvaluationContext context = new StandardEvaluationContext(new C());
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
String el1 = "ls.![#this.equals('abc')]";
|
String el1 = "ls.![#this.equals('abc')]";
|
||||||
SpelExpression exp = parser.parseRaw(el1);
|
SpelExpression exp = parser.parseRaw(el1);
|
||||||
List<?> value = (List<?>) exp.getValue(ctx);
|
List<?> value = (List<?>) exp.getValue(context);
|
||||||
// value is list containing [true,false]
|
// value is list containing [true,false]
|
||||||
assertEquals(Boolean.class, value.get(0).getClass());
|
assertEquals(Boolean.class, value.get(0).getClass());
|
||||||
TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
|
TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
|
||||||
assertEquals(null, evaluated.getElementTypeDescriptor());
|
assertEquals(null, evaluated.getElementTypeDescriptor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void projectionTypeDescriptors_2() {
|
public void projectionTypeDescriptors_2() {
|
||||||
StandardEvaluationContext ctx = new StandardEvaluationContext(new C());
|
StandardEvaluationContext context = new StandardEvaluationContext(new C());
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
String el1 = "as.![#this.equals('abc')]";
|
String el1 = "as.![#this.equals('abc')]";
|
||||||
SpelExpression exp = parser.parseRaw(el1);
|
SpelExpression exp = parser.parseRaw(el1);
|
||||||
Object[] value = (Object[]) exp.getValue(ctx);
|
Object[] value = (Object[]) exp.getValue(context);
|
||||||
// value is array containing [true,false]
|
// value is array containing [true,false]
|
||||||
assertEquals(Boolean.class, value[0].getClass());
|
assertEquals(Boolean.class, value[0].getClass());
|
||||||
TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
|
TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
|
||||||
assertEquals(Boolean.class, evaluated.getElementTypeDescriptor().getType());
|
assertEquals(Boolean.class, evaluated.getElementTypeDescriptor().getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void projectionTypeDescriptors_3() {
|
public void projectionTypeDescriptors_3() {
|
||||||
StandardEvaluationContext ctx = new StandardEvaluationContext(new C());
|
StandardEvaluationContext context = new StandardEvaluationContext(new C());
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
String el1 = "ms.![key.equals('abc')]";
|
String el1 = "ms.![key.equals('abc')]";
|
||||||
SpelExpression exp = parser.parseRaw(el1);
|
SpelExpression exp = parser.parseRaw(el1);
|
||||||
List<?> value = (List<?>) exp.getValue(ctx);
|
List<?> value = (List<?>) exp.getValue(context);
|
||||||
// value is list containing [true,false]
|
// value is list containing [true,false]
|
||||||
assertEquals(Boolean.class, value.get(0).getClass());
|
assertEquals(Boolean.class, value.get(0).getClass());
|
||||||
TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
|
TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
|
||||||
assertEquals(null, evaluated.getElementTypeDescriptor());
|
assertEquals(null, evaluated.getElementTypeDescriptor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,23 +615,23 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
list.add(new D(null));
|
list.add(new D(null));
|
||||||
list.add(new D("zzz"));
|
list.add(new D("zzz"));
|
||||||
|
|
||||||
StandardEvaluationContext ctx = new StandardEvaluationContext(list);
|
StandardEvaluationContext context = new StandardEvaluationContext(list);
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
|
|
||||||
String el1 = "#root.?[a < 'hhh']";
|
String el1 = "#root.?[a < 'hhh']";
|
||||||
SpelExpression exp = parser.parseRaw(el1);
|
SpelExpression exp = parser.parseRaw(el1);
|
||||||
Object value = exp.getValue(ctx);
|
Object value = exp.getValue(context);
|
||||||
assertEquals("[D(aaa), D(bbb), D(null), D(ccc), D(null)]", value.toString());
|
assertEquals("[D(aaa), D(bbb), D(null), D(ccc), D(null)]", value.toString());
|
||||||
|
|
||||||
String el2 = "#root.?[a > 'hhh']";
|
String el2 = "#root.?[a > 'hhh']";
|
||||||
SpelExpression exp2 = parser.parseRaw(el2);
|
SpelExpression exp2 = parser.parseRaw(el2);
|
||||||
Object value2 = exp2.getValue(ctx);
|
Object value2 = exp2.getValue(context);
|
||||||
assertEquals("[D(zzz)]", value2.toString());
|
assertEquals("[D(zzz)]", value2.toString());
|
||||||
|
|
||||||
// trim out the nulls first
|
// trim out the nulls first
|
||||||
String el3 = "#root.?[a!=null].?[a < 'hhh']";
|
String el3 = "#root.?[a!=null].?[a < 'hhh']";
|
||||||
SpelExpression exp3 = parser.parseRaw(el3);
|
SpelExpression exp3 = parser.parseRaw(el3);
|
||||||
Object value3 = exp3.getValue(ctx);
|
Object value3 = exp3.getValue(context);
|
||||||
assertEquals("[D(aaa), D(bbb), D(ccc)]", value3.toString());
|
assertEquals("[D(aaa), D(bbb), D(ccc)]", value3.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,41 +820,41 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StandardEvaluationContext ctx = new StandardEvaluationContext(new Reserver());
|
StandardEvaluationContext context = new StandardEvaluationContext(new Reserver());
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
String ex = "getReserver().NE";
|
String ex = "getReserver().NE";
|
||||||
SpelExpression exp = parser.parseRaw(ex);
|
SpelExpression exp = parser.parseRaw(ex);
|
||||||
String value = (String) exp.getValue(ctx);
|
String value = (String) exp.getValue(context);
|
||||||
assertEquals("abc", value);
|
assertEquals("abc", value);
|
||||||
|
|
||||||
ex = "getReserver().ne";
|
ex = "getReserver().ne";
|
||||||
exp = parser.parseRaw(ex);
|
exp = parser.parseRaw(ex);
|
||||||
value = (String) exp.getValue(ctx);
|
value = (String) exp.getValue(context);
|
||||||
assertEquals("def", value);
|
assertEquals("def", value);
|
||||||
|
|
||||||
ex = "getReserver().m[NE]";
|
ex = "getReserver().m[NE]";
|
||||||
exp = parser.parseRaw(ex);
|
exp = parser.parseRaw(ex);
|
||||||
value = (String) exp.getValue(ctx);
|
value = (String) exp.getValue(context);
|
||||||
assertEquals("xyz", value);
|
assertEquals("xyz", value);
|
||||||
|
|
||||||
ex = "getReserver().DIV";
|
ex = "getReserver().DIV";
|
||||||
exp = parser.parseRaw(ex);
|
exp = parser.parseRaw(ex);
|
||||||
assertEquals(1, exp.getValue(ctx));
|
assertEquals(1, exp.getValue(context));
|
||||||
|
|
||||||
ex = "getReserver().div";
|
ex = "getReserver().div";
|
||||||
exp = parser.parseRaw(ex);
|
exp = parser.parseRaw(ex);
|
||||||
assertEquals(3, exp.getValue(ctx));
|
assertEquals(3, exp.getValue(context));
|
||||||
|
|
||||||
exp = parser.parseRaw("NE");
|
exp = parser.parseRaw("NE");
|
||||||
assertEquals("abc", exp.getValue(ctx));
|
assertEquals("abc", exp.getValue(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void reservedWordProperties_SPR9862() {
|
public void reservedWordProperties_SPR9862() {
|
||||||
StandardEvaluationContext ctx = new StandardEvaluationContext();
|
StandardEvaluationContext context = new StandardEvaluationContext();
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
SpelExpression expression = parser.parseRaw("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST");
|
SpelExpression expression = parser.parseRaw("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST");
|
||||||
Object value = expression.getValue(ctx);
|
Object value = expression.getValue(context);
|
||||||
assertEquals(value, Reserver.CONST);
|
assertEquals(value, Reserver.CONST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue