Consistent formatting
This commit is contained in:
@@ -918,7 +918,7 @@ public class CodeFlow implements Opcodes {
|
||||
*/
|
||||
public static boolean isReferenceTypeArray(String arraytype) {
|
||||
int length = arraytype.length();
|
||||
for (int i=0;i<length;i++) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
char ch = arraytype.charAt(i);
|
||||
if (ch == '[') continue;
|
||||
return ch=='L';
|
||||
|
||||
@@ -71,7 +71,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
o = parser.parseExpression("list2[3]").getValue(new StandardEvaluationContext(testClass));
|
||||
fail();
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
ee.printStackTrace();
|
||||
// success!
|
||||
}
|
||||
@@ -241,7 +242,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
new SpelExpressionParser().parseExpression("placeOfBirth.foo.");
|
||||
fail("Should have failed to parse");
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
catch (ParseException e) {
|
||||
assertTrue(e instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) e;
|
||||
assertEquals(SpelMessage.OOD, spe.getMessageCode());
|
||||
@@ -265,7 +267,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
new SpelExpressionParser().parseRaw("placeOfBirth.23");
|
||||
fail();
|
||||
} catch (SpelParseException spe) {
|
||||
}
|
||||
catch (SpelParseException spe) {
|
||||
assertEquals(spe.getMessageCode(), SpelMessage.UNEXPECTED_DATA_AFTER_DOT);
|
||||
assertEquals("23", spe.getInserts()[0]);
|
||||
}
|
||||
@@ -554,7 +557,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
assertFalse(parser.parseExpression("T(List)!=null").getValue(context, Boolean.class));
|
||||
fail("should have failed to find List");
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
// success - List not found
|
||||
}
|
||||
((StandardTypeLocator) context.getTypeLocator()).registerImport("java.util");
|
||||
@@ -633,7 +637,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
context.registerMethodFilter(String.class, filter);
|
||||
fail("should have failed");
|
||||
} catch (IllegalStateException ise) {
|
||||
}
|
||||
catch (IllegalStateException ise) {
|
||||
assertEquals(
|
||||
"Method filter cannot be set as the reflective method resolver is not in use",
|
||||
ise.getMessage());
|
||||
@@ -738,7 +743,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
e.getValue(ctx,String.class);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.COLLECTION_INDEX_OUT_OF_BOUNDS,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
@@ -754,7 +760,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
expression = parser.parseExpression("foo[3]");
|
||||
try {
|
||||
expression.setValue(ctx, "3");
|
||||
} catch(SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.UNABLE_TO_GROW_COLLECTION, see.getMessageCode());
|
||||
assertThat(instance.getFoo().size(), equalTo(3));
|
||||
}
|
||||
@@ -771,7 +778,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
e.getValue(ctx,Integer.class);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
@@ -894,7 +902,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
e.getValue(ctx,Double.TYPE);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.OPERAND_NOT_INCREMENTABLE,see.getMessageCode());
|
||||
}
|
||||
|
||||
@@ -902,7 +911,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
e.getValue(ctx,Double.TYPE);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.OPERAND_NOT_INCREMENTABLE,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
@@ -917,14 +927,16 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
Expression e = parser.parseExpression("++1");
|
||||
e.getValue(ctx,Integer.class);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
|
||||
}
|
||||
try {
|
||||
Expression e = parser.parseExpression("1++");
|
||||
e.getValue(ctx,Integer.class);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
@@ -938,7 +950,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
e.getValue(ctx,Integer.class);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
@@ -1060,7 +1073,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
e.getValue(ctx,Double.TYPE);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.OPERAND_NOT_DECREMENTABLE,see.getMessageCode());
|
||||
}
|
||||
|
||||
@@ -1068,7 +1082,8 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
try {
|
||||
e.getValue(ctx,Double.TYPE);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.OPERAND_NOT_DECREMENTABLE,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
@@ -1083,14 +1098,16 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
Expression e = parser.parseExpression("--1");
|
||||
e.getValue(ctx,Integer.class);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
|
||||
}
|
||||
try {
|
||||
Expression e = parser.parseExpression("1--");
|
||||
e.getValue(ctx,Integer.class);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
@@ -1123,36 +1140,6 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void expectFail(ExpressionParser parser, EvaluationContext eContext, String expressionString, SpelMessage messageCode) {
|
||||
try {
|
||||
Expression e = parser.parseExpression(expressionString);
|
||||
SpelUtilities.printAbstractSyntaxTree(System.out, e);
|
||||
e.getValue(eContext);
|
||||
fail();
|
||||
} catch (SpelEvaluationException see) {
|
||||
see.printStackTrace();
|
||||
assertEquals(messageCode,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
|
||||
private void expectFailNotAssignable(ExpressionParser parser, EvaluationContext eContext, String expressionString) {
|
||||
expectFail(parser,eContext,expressionString,SpelMessage.NOT_ASSIGNABLE);
|
||||
}
|
||||
|
||||
private void expectFailSetValueNotSupported(ExpressionParser parser, EvaluationContext eContext, String expressionString) {
|
||||
expectFail(parser,eContext,expressionString,SpelMessage.SETVALUE_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
private void expectFailNotIncrementable(ExpressionParser parser, EvaluationContext eContext, String expressionString) {
|
||||
expectFail(parser,eContext,expressionString,SpelMessage.OPERAND_NOT_INCREMENTABLE);
|
||||
}
|
||||
|
||||
private void expectFailNotDecrementable(ExpressionParser parser, EvaluationContext eContext, String expressionString) {
|
||||
expectFail(parser,eContext,expressionString,SpelMessage.OPERAND_NOT_DECREMENTABLE);
|
||||
}
|
||||
|
||||
// Verify how all the nodes behave with assignment (++, --, =)
|
||||
@Test
|
||||
public void incrementAllNodeTypes() throws SecurityException, NoSuchMethodException {
|
||||
@@ -1456,9 +1443,39 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
r = e.getValue(ctx,Integer.TYPE);
|
||||
assertEquals(100,r);
|
||||
assertEquals(100,helper.iii);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void expectFail(ExpressionParser parser, EvaluationContext eContext, String expressionString, SpelMessage messageCode) {
|
||||
try {
|
||||
Expression e = parser.parseExpression(expressionString);
|
||||
SpelUtilities.printAbstractSyntaxTree(System.out, e);
|
||||
e.getValue(eContext);
|
||||
fail();
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
see.printStackTrace();
|
||||
assertEquals(messageCode,see.getMessageCode());
|
||||
}
|
||||
}
|
||||
|
||||
private void expectFailNotAssignable(ExpressionParser parser, EvaluationContext eContext, String expressionString) {
|
||||
expectFail(parser,eContext,expressionString,SpelMessage.NOT_ASSIGNABLE);
|
||||
}
|
||||
|
||||
private void expectFailSetValueNotSupported(ExpressionParser parser, EvaluationContext eContext, String expressionString) {
|
||||
expectFail(parser,eContext,expressionString,SpelMessage.SETVALUE_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
private void expectFailNotIncrementable(ExpressionParser parser, EvaluationContext eContext, String expressionString) {
|
||||
expectFail(parser,eContext,expressionString,SpelMessage.OPERAND_NOT_INCREMENTABLE);
|
||||
}
|
||||
|
||||
private void expectFailNotDecrementable(ExpressionParser parser, EvaluationContext eContext, String expressionString) {
|
||||
expectFail(parser,eContext,expressionString,SpelMessage.OPERAND_NOT_DECREMENTABLE);
|
||||
}
|
||||
|
||||
|
||||
static class MyBeanResolver implements BeanResolver {
|
||||
|
||||
@Override
|
||||
@@ -1472,5 +1489,4 @@ public class EvaluationTests extends AbstractExpressionTests {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -79,10 +79,12 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
|
||||
|
||||
assertEquals("hello world", value);
|
||||
assertEquals(String.class, value.getClass());
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
ee.printStackTrace();
|
||||
fail("Unexpected Exception: " + ee.getMessage());
|
||||
} catch (ParseException pe) {
|
||||
}
|
||||
catch (ParseException pe) {
|
||||
pe.printStackTrace();
|
||||
fail("Unexpected Exception: " + pe.getMessage());
|
||||
}
|
||||
@@ -186,10 +188,12 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
|
||||
Object value = expr.getValue(ctx);
|
||||
assertEquals("hellohello", value);
|
||||
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
ee.printStackTrace();
|
||||
fail("Unexpected Exception: " + ee.getMessage());
|
||||
} catch (ParseException pe) {
|
||||
}
|
||||
catch (ParseException pe) {
|
||||
pe.printStackTrace();
|
||||
fail("Unexpected Exception: " + pe.getMessage());
|
||||
}
|
||||
@@ -213,7 +217,8 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
|
||||
try {
|
||||
expr.setValue(ctx, Color.blue);
|
||||
fail("Should not be allowed to set oranges to be blue !");
|
||||
} catch (SpelEvaluationException ee) {
|
||||
}
|
||||
catch (SpelEvaluationException ee) {
|
||||
assertEquals(ee.getMessageCode(), SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,8 @@ public class ExpressionStateTests extends AbstractExpressionTests {
|
||||
try {
|
||||
state.popActiveContextObject();
|
||||
fail("stack should be empty...");
|
||||
} catch (EmptyStackException ese) {
|
||||
}
|
||||
catch (EmptyStackException ese) {
|
||||
// success
|
||||
}
|
||||
|
||||
@@ -221,7 +222,8 @@ public class ExpressionStateTests extends AbstractExpressionTests {
|
||||
try {
|
||||
state.operate(Operation.ADD,1,2);
|
||||
fail("should have failed");
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
SpelEvaluationException sEx = (SpelEvaluationException)ee;
|
||||
assertEquals(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES,sEx.getMessageCode());
|
||||
}
|
||||
@@ -229,7 +231,8 @@ public class ExpressionStateTests extends AbstractExpressionTests {
|
||||
try {
|
||||
state.operate(Operation.ADD,null,null);
|
||||
fail("should have failed");
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
SpelEvaluationException sEx = (SpelEvaluationException)ee;
|
||||
assertEquals(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES,sEx.getMessageCode());
|
||||
}
|
||||
@@ -249,7 +252,8 @@ public class ExpressionStateTests extends AbstractExpressionTests {
|
||||
try {
|
||||
state.findType("someMadeUpName");
|
||||
fail("Should have failed to find it");
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
SpelEvaluationException sEx = (SpelEvaluationException)ee;
|
||||
assertEquals(SpelMessage.TYPE_NOT_FOUND,sEx.getMessageCode());
|
||||
}
|
||||
|
||||
@@ -191,8 +191,9 @@ public class IndexingTests {
|
||||
expression = parser.parseExpression("property[0]");
|
||||
try {
|
||||
expression.setValue(this, "4");
|
||||
} catch (EvaluationException e) {
|
||||
assertTrue(e.getMessage().startsWith("EL1053E"));
|
||||
}
|
||||
catch (EvaluationException ex) {
|
||||
assertTrue(ex.getMessage().startsWith("EL1053E"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,8 +252,9 @@ public class IndexingTests {
|
||||
expression = parser.parseExpression("property[0]");
|
||||
try {
|
||||
assertEquals("bar", expression.getValue(this));
|
||||
} catch (EvaluationException e) {
|
||||
assertTrue(e.getMessage().startsWith("EL1027E"));
|
||||
}
|
||||
catch (EvaluationException ex) {
|
||||
assertTrue(ex.getMessage().startsWith("EL1027E"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,8 +270,9 @@ public class IndexingTests {
|
||||
expression = parser.parseExpression("property[0]");
|
||||
try {
|
||||
assertEquals("bar", expression.getValue(this));
|
||||
} catch (EvaluationException e) {
|
||||
assertTrue(e.getMessage().startsWith("EL1053E"));
|
||||
}
|
||||
catch (EvaluationException ex) {
|
||||
assertTrue(ex.getMessage().startsWith("EL1053E"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,8 +288,9 @@ public class IndexingTests {
|
||||
expression = parser.parseExpression("property2[0]");
|
||||
try {
|
||||
assertEquals("bar", expression.getValue(this));
|
||||
} catch (EvaluationException e) {
|
||||
assertTrue(e.getMessage().startsWith("EL1053E"));
|
||||
}
|
||||
catch (EvaluationException ex) {
|
||||
assertTrue(ex.getMessage().startsWith("EL1053E"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -33,29 +33,6 @@ import static org.junit.Assert.*;
|
||||
*/
|
||||
public class OperatorOverloaderTests extends AbstractExpressionTests {
|
||||
|
||||
static class StringAndBooleanAddition implements OperatorOverloader {
|
||||
|
||||
@Override
|
||||
public Object operate(Operation operation, Object leftOperand, Object rightOperand) throws EvaluationException {
|
||||
if (operation==Operation.ADD) {
|
||||
return ((String)leftOperand)+((Boolean)rightOperand).toString();
|
||||
} else {
|
||||
return leftOperand;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean overridesOperation(Operation operation, Object leftOperand, Object rightOperand)
|
||||
throws EvaluationException {
|
||||
if (leftOperand instanceof String && rightOperand instanceof Boolean) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleOperations() throws Exception {
|
||||
// no built in support for this:
|
||||
@@ -73,4 +50,28 @@ public class OperatorOverloaderTests extends AbstractExpressionTests {
|
||||
expr = (SpelExpression)parser.parseExpression("'abc'+null");
|
||||
assertEquals("abcnull",expr.getValue(eContext));
|
||||
}
|
||||
|
||||
|
||||
static class StringAndBooleanAddition implements OperatorOverloader {
|
||||
|
||||
@Override
|
||||
public Object operate(Operation operation, Object leftOperand, Object rightOperand) throws EvaluationException {
|
||||
if (operation==Operation.ADD) {
|
||||
return ((String)leftOperand)+((Boolean)rightOperand).toString();
|
||||
}
|
||||
else {
|
||||
return leftOperand;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean overridesOperation(Operation operation, Object leftOperand, Object rightOperand) throws EvaluationException {
|
||||
if (leftOperand instanceof String && rightOperand instanceof Boolean) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -462,7 +462,8 @@ public class ParsingTests {
|
||||
fail("Parsed exception was null");
|
||||
}
|
||||
assertEquals("String form of AST does not match expected output", expectedStringFormOfAST, e.toStringAST());
|
||||
} catch (ParseException ee) {
|
||||
}
|
||||
catch (ParseException ee) {
|
||||
ee.printStackTrace();
|
||||
fail("Unexpected Exception: " + ee.getMessage());
|
||||
}
|
||||
|
||||
@@ -78,15 +78,17 @@ public class PropertyAccessTests extends AbstractExpressionTests {
|
||||
try {
|
||||
expr.getValue(context);
|
||||
fail("Should have failed - default property resolver cannot resolve on null");
|
||||
} catch (Exception e) {
|
||||
checkException(e,SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE_ON_NULL);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
checkException(ex, SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE_ON_NULL);
|
||||
}
|
||||
assertFalse(expr.isWritable(context));
|
||||
try {
|
||||
expr.setValue(context,"abc");
|
||||
fail("Should have failed - default property resolver cannot resolve on null");
|
||||
} catch (Exception e) {
|
||||
checkException(e,SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
checkException(ex, SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +96,8 @@ public class PropertyAccessTests extends AbstractExpressionTests {
|
||||
if (e instanceof SpelEvaluationException) {
|
||||
SpelMessage sm = ((SpelEvaluationException)e).getMessageCode();
|
||||
assertEquals("Expected exception type did not occur",expectedMessage,sm);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fail("Should be a SpelException "+e);
|
||||
}
|
||||
}
|
||||
@@ -127,7 +130,8 @@ public class PropertyAccessTests extends AbstractExpressionTests {
|
||||
try {
|
||||
expr.setValue(ctx, "not allowed");
|
||||
fail("Should not have been allowed");
|
||||
} catch (EvaluationException e) {
|
||||
}
|
||||
catch (EvaluationException ex) {
|
||||
// success - message will be: EL1063E:(pos 20): A problem occurred whilst attempting to set the property
|
||||
// 'flibbles': 'Cannot set flibbles to an object of type 'class java.lang.String''
|
||||
// System.out.println(e.getMessage());
|
||||
@@ -171,38 +175,42 @@ public class PropertyAccessTests extends AbstractExpressionTests {
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class[] { String.class };
|
||||
return new Class[] {String.class};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
if (!(target instanceof String))
|
||||
if (!(target instanceof String)) {
|
||||
throw new RuntimeException("Assertion Failed! target should be String");
|
||||
}
|
||||
return (name.equals("flibbles"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
if (!(target instanceof String))
|
||||
if (!(target instanceof String)) {
|
||||
throw new RuntimeException("Assertion Failed! target should be String");
|
||||
}
|
||||
return (name.equals("flibbles"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
if (!name.equals("flibbles"))
|
||||
if (!name.equals("flibbles")) {
|
||||
throw new RuntimeException("Assertion Failed! name should be flibbles");
|
||||
}
|
||||
return new TypedValue(flibbles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue)
|
||||
throws AccessException {
|
||||
if (!name.equals("flibbles"))
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
|
||||
if (!name.equals("flibbles")) {
|
||||
throw new RuntimeException("Assertion Failed! name should be flibbles");
|
||||
}
|
||||
try {
|
||||
flibbles = (Integer) context.getTypeConverter().convertValue(newValue, TypeDescriptor.forObject(newValue), TypeDescriptor.valueOf(Integer.class));
|
||||
}catch (EvaluationException e) {
|
||||
}
|
||||
catch (EvaluationException ex) {
|
||||
throw new AccessException("Cannot set flibbles to an object of type '" + newValue.getClass() + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,8 @@ public class ScenariosForSpringSecurity extends AbstractExpressionTests {
|
||||
value = expr.getValue(ctx,Boolean.class);
|
||||
assertTrue(value);
|
||||
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
ee.printStackTrace();
|
||||
fail("Unexpected SpelException: " + ee.getMessage());
|
||||
}
|
||||
@@ -160,10 +161,10 @@ public class ScenariosForSpringSecurity extends AbstractExpressionTests {
|
||||
public String[] getRoles() { return new String[]{"NONE"}; }
|
||||
|
||||
public boolean hasAnyRole(String... roles) {
|
||||
if (roles==null) return true;
|
||||
if (roles == null) return true;
|
||||
String[] myRoles = getRoles();
|
||||
for (int i=0;i<myRoles.length;i++) {
|
||||
for (int j=0;j<roles.length;j++) {
|
||||
for (int i = 0; i < myRoles.length; i++) {
|
||||
for (int j = 0; j < roles.length; j++) {
|
||||
if (myRoles[i].equals(roles[j])) return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +428,8 @@ public class SelectionAndProjectionTests {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (i == 1) {
|
||||
array[i] = new IntegerTestBean(5.9f);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
array[i] = new IntegerTestBean(i + 5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -39,6 +39,7 @@ public class SetValueTests extends AbstractExpressionTests {
|
||||
|
||||
private final static boolean DEBUG = false;
|
||||
|
||||
|
||||
@Test
|
||||
public void testSetProperty() {
|
||||
setValue("wonNobelPrize", true);
|
||||
@@ -90,7 +91,8 @@ public class SetValueTests extends AbstractExpressionTests {
|
||||
try {
|
||||
assertFalse("Should not be writable!",e.isWritable(lContext));
|
||||
fail("Should have had an error because wibble does not really exist");
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
// org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 15): Property or field 'wibble' cannot be found on object of type 'org.springframework.expression.spel.testresources.ArrayContainer' - maybe not public?
|
||||
// at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:225)
|
||||
// success!
|
||||
@@ -110,7 +112,8 @@ public class SetValueTests extends AbstractExpressionTests {
|
||||
try {
|
||||
assertFalse("Should not be writable!",e.isWritable(lContext));
|
||||
fail("Should have had an error because wibble does not really exist");
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
// success!
|
||||
}
|
||||
|
||||
@@ -119,7 +122,8 @@ public class SetValueTests extends AbstractExpressionTests {
|
||||
try {
|
||||
assertFalse("Should not be writable!",e.isWritable(lContext));
|
||||
fail("Should have had an error because wibble does not really exist");
|
||||
} catch (SpelEvaluationException see) {
|
||||
}
|
||||
catch (SpelEvaluationException see) {
|
||||
// success!
|
||||
}
|
||||
}
|
||||
@@ -247,10 +251,12 @@ public class SetValueTests extends AbstractExpressionTests {
|
||||
StandardEvaluationContext lContext = TestScenarioCreator.getTestEvaluationContext();
|
||||
e.setValue(lContext, value);
|
||||
fail("expected an error");
|
||||
} catch (ParseException pe) {
|
||||
}
|
||||
catch (ParseException pe) {
|
||||
pe.printStackTrace();
|
||||
fail("Unexpected Exception: " + pe.getMessage());
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
// success!
|
||||
}
|
||||
}
|
||||
@@ -268,10 +274,12 @@ public class SetValueTests extends AbstractExpressionTests {
|
||||
assertTrue("Expression is not writeable but should be", e.isWritable(lContext));
|
||||
e.setValue(lContext, value);
|
||||
assertEquals("Retrieved value was not equal to set value", value, e.getValue(lContext,value.getClass()));
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
ee.printStackTrace();
|
||||
fail("Unexpected Exception: " + ee.getMessage());
|
||||
} catch (ParseException pe) {
|
||||
}
|
||||
catch (ParseException pe) {
|
||||
pe.printStackTrace();
|
||||
fail("Unexpected Exception: " + pe.getMessage());
|
||||
}
|
||||
@@ -299,12 +307,15 @@ public class SetValueTests extends AbstractExpressionTests {
|
||||
fail("Not the same: ["+a+"] type="+a.getClass()+" ["+b+"] type="+b.getClass());
|
||||
// assertEquals("Retrieved value was not equal to set value", expectedValue, e.getValue(lContext));
|
||||
}
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
ee.printStackTrace();
|
||||
fail("Unexpected Exception: " + ee.getMessage());
|
||||
} catch (ParseException pe) {
|
||||
}
|
||||
catch (ParseException pe) {
|
||||
pe.printStackTrace();
|
||||
fail("Unexpected Exception: " + pe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4267,7 +4267,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
|
||||
|
||||
// // time it interpreted
|
||||
// long stime = System.currentTimeMillis();
|
||||
// for (int i=0;i<100000;i++) {
|
||||
// for (int i = 0;i<100000;i++) {
|
||||
// v = expression.getValue(ctx,holder);
|
||||
// }
|
||||
// System.out.println((System.currentTimeMillis()-stime));
|
||||
@@ -4278,7 +4278,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
|
||||
//
|
||||
// // time it compiled
|
||||
// stime = System.currentTimeMillis();
|
||||
// for (int i=0;i<100000;i++) {
|
||||
// for (int i = 0;i<100000;i++) {
|
||||
// v = expression.getValue(ctx,holder);
|
||||
// }
|
||||
// System.out.println((System.currentTimeMillis()-stime));
|
||||
@@ -5014,7 +5014,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
|
||||
|
||||
public void reset() {
|
||||
i = 0;
|
||||
_i=0;
|
||||
_i = 0;
|
||||
s = null;
|
||||
_s = null;
|
||||
field = null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 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.
|
||||
@@ -79,80 +79,80 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
assertEquals(2d,o);
|
||||
System.out.println("Performance check for SpEL expression: '(T(Integer).valueOf(payload).doubleValue())/18D'");
|
||||
long stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
compile(expression);
|
||||
System.out.println("Now compiled:");
|
||||
o = expression.getValue(nh);
|
||||
assertEquals(2d, o);
|
||||
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
|
||||
expression = parser.parseExpression("payload/18D");
|
||||
o = expression.getValue(nh);
|
||||
assertEquals(2d,o);
|
||||
System.out.println("Performance check for SpEL expression: 'payload/18D'");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
compile(expression);
|
||||
System.out.println("Now compiled:");
|
||||
o = expression.getValue(nh);
|
||||
assertEquals(2d, o);
|
||||
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(nh);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -162,40 +162,40 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
assertEquals("bc",o);
|
||||
System.out.println("Performance check for SpEL expression: '{'abcde','ijklm'}[0].substring({1,3,4}[0],{1,3,4}[1])'");
|
||||
long stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
compile(expression);
|
||||
System.out.println("Now compiled:");
|
||||
o = expression.getValue();
|
||||
assertEquals("bc", o);
|
||||
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -205,40 +205,40 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
assertEquals("jk",o);
|
||||
System.out.println("Performance check for SpEL expression: '{'abcde','ijklm'}[0].substring({1,3,4}[0],{1,3,4}[1])'");
|
||||
long stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
compile(expression);
|
||||
System.out.println("Now compiled:");
|
||||
o = expression.getValue();
|
||||
assertEquals("jk", o);
|
||||
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue();
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
}
|
||||
|
||||
|
||||
@@ -251,40 +251,40 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
|
||||
System.out.println("Performance check for SpEL expression: 'hello' + getWorld() + ' spring'");
|
||||
long stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(g);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(g);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(g);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
compile(expression);
|
||||
System.out.println("Now compiled:");
|
||||
o = expression.getValue(g);
|
||||
assertEquals("helloworld spring", o);
|
||||
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(g);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(g);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<1000000;i++) {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
o = expression.getValue(g);
|
||||
}
|
||||
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
|
||||
System.out.println("One million iterations: " + (System.currentTimeMillis()-stime) + "ms");
|
||||
}
|
||||
|
||||
public static class Greeter {
|
||||
@@ -301,15 +301,15 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
long iTotal = 0,cTotal = 0;
|
||||
|
||||
// warmup
|
||||
for (int i=0;i<count;i++) {
|
||||
b = expression.getValue(payload,Boolean.TYPE);
|
||||
for (int i = 0; i < count; i++) {
|
||||
b = expression.getValue(payload, Boolean.TYPE);
|
||||
}
|
||||
|
||||
log("timing interpreted: ");
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
long stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
b = expression.getValue(payload,Boolean.TYPE);
|
||||
for (int j = 0; j < count; j++) {
|
||||
b = expression.getValue(payload, Boolean.TYPE);
|
||||
}
|
||||
long etime = System.currentTimeMillis();
|
||||
long interpretedSpeed = (etime - stime);
|
||||
@@ -320,12 +320,12 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
|
||||
compile(expression);
|
||||
boolean bc = false;
|
||||
expression.getValue(payload,Boolean.TYPE);
|
||||
expression.getValue(payload, Boolean.TYPE);
|
||||
log("timing compiled: ");
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
long stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
bc = expression.getValue(payload,Boolean.TYPE);
|
||||
for (int j = 0; j < count; j++) {
|
||||
bc = expression.getValue(payload, Boolean.TYPE);
|
||||
}
|
||||
long etime = System.currentTimeMillis();
|
||||
long compiledSpeed = (etime - stime);
|
||||
@@ -340,11 +340,11 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
assertFalse(b);
|
||||
|
||||
// Verify the same result for compiled vs interpreted
|
||||
assertEquals(b,bc);
|
||||
assertEquals(b, bc);
|
||||
|
||||
// Verify if the input changes, the result changes
|
||||
payload.DR[0].DRFixedSection.duration = 0.04d;
|
||||
bc = expression.getValue(payload,Boolean.TYPE);
|
||||
bc = expression.getValue(payload, Boolean.TYPE);
|
||||
assertTrue(bc);
|
||||
}
|
||||
|
||||
@@ -364,15 +364,15 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
Expression expression = parser.parseExpression("hello()");
|
||||
|
||||
// warmup
|
||||
for (int i=0;i<count;i++) {
|
||||
interpretedResult = expression.getValue(testdata,String.class);
|
||||
for (int i = 0; i < count; i++) {
|
||||
interpretedResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
|
||||
log("timing interpreted: ");
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
interpretedResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
interpretedResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long interpretedSpeed = (etime - stime);
|
||||
@@ -384,11 +384,11 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
compile(expression);
|
||||
|
||||
log("timing compiled: ");
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
compiledResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
compiledResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long compiledSpeed = (etime - stime);
|
||||
@@ -438,15 +438,15 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
Expression expression = parser.parseExpression("name");
|
||||
|
||||
// warmup
|
||||
for (int i=0;i<count;i++) {
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int i = 0; i < count; i++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
}
|
||||
|
||||
log("timing interpreted: ");
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
interpretedResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
interpretedResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long interpretedSpeed = (etime - stime);
|
||||
@@ -458,11 +458,11 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
compile(expression);
|
||||
|
||||
log("timing compiled: ");
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
compiledResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
compiledResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long compiledSpeed = (etime - stime);
|
||||
@@ -485,15 +485,15 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
Expression expression = parser.parseExpression("foo.bar.boo");
|
||||
|
||||
// warmup
|
||||
for (int i=0;i<count;i++) {
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int i = 0; i < count; i++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
}
|
||||
|
||||
log("timing interpreted: ");
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
interpretedResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
interpretedResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long interpretedSpeed = (etime - stime);
|
||||
@@ -505,11 +505,11 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
compile(expression);
|
||||
|
||||
log("timing compiled: ");
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
compiledResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
compiledResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long compiledSpeed = (etime - stime);
|
||||
@@ -531,14 +531,14 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
Expression expression = parser.parseExpression("foo.baz.boo");
|
||||
|
||||
// warmup
|
||||
for (int i=0;i<count;i++) {
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int i = 0; i < count; i++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
}
|
||||
log("timing interpreted: ");
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
interpretedResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
interpretedResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long interpretedSpeed = (etime - stime);
|
||||
@@ -550,11 +550,11 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
compile(expression);
|
||||
|
||||
log("timing compiled: ");
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
compiledResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
compiledResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long compiledSpeed = (etime - stime);
|
||||
@@ -576,42 +576,42 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
Expression expression = parser.parseExpression("foo.bay().boo");
|
||||
|
||||
// warmup
|
||||
for (int i=0;i<count;i++) {
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int i = 0; i < count; i++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
}
|
||||
|
||||
log("timing interpreted: ");
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
interpretedResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
interpretedResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long interpretedSpeed = (etime - stime);
|
||||
interpretedTotal+=interpretedSpeed;
|
||||
log(interpretedSpeed+"ms ");
|
||||
interpretedTotal += interpretedSpeed;
|
||||
log(interpretedSpeed + "ms ");
|
||||
}
|
||||
logln();
|
||||
|
||||
compile(expression);
|
||||
|
||||
log("timing compiled: ");
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
compiledResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
compiledResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long compiledSpeed = (etime - stime);
|
||||
compiledTotal+=compiledSpeed;
|
||||
log(compiledSpeed+"ms ");
|
||||
compiledTotal += compiledSpeed;
|
||||
log(compiledSpeed + "ms ");
|
||||
|
||||
}
|
||||
logln();
|
||||
|
||||
assertEquals(interpretedResult,compiledResult);
|
||||
reportPerformance("nested reference (mixed field/method)",interpretedTotal, compiledTotal);
|
||||
reportPerformance("nested reference (mixed field/method)", interpretedTotal, compiledTotal);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -623,15 +623,15 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
Expression expression = parser.parseExpression("name2");
|
||||
|
||||
// warmup
|
||||
for (int i=0;i<count;i++) {
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int i = 0;i < count; i++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
}
|
||||
|
||||
log("timing interpreted: ");
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
interpretedResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
interpretedResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long interpretedSpeed = (etime - stime);
|
||||
@@ -644,11 +644,11 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
compile(expression);
|
||||
|
||||
log("timing compiled: ");
|
||||
expression.getValue(testdata,String.class);
|
||||
for (int iter=0;iter<iterations;iter++) {
|
||||
expression.getValue(testdata, String.class);
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
stime = System.currentTimeMillis();
|
||||
for (int i=0;i<count;i++) {
|
||||
compiledResult = expression.getValue(testdata,String.class);
|
||||
for (int j = 0; j < count; j++) {
|
||||
compiledResult = expression.getValue(testdata, String.class);
|
||||
}
|
||||
etime = System.currentTimeMillis();
|
||||
long compiledSpeed = (etime - stime);
|
||||
@@ -672,7 +672,7 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
double averageInterpreted = interpretedTotal/(iterations);
|
||||
double averageCompiled = compiledTotal/(iterations);
|
||||
double ratio = (averageCompiled/averageInterpreted)*100.0d;
|
||||
logln(">>"+title+": average for "+count+": compiled="+averageCompiled+"ms interpreted="+averageInterpreted+"ms: compiled takes "+((int)ratio)+"% of the interpreted time");
|
||||
logln(">>"+title+": average for "+count+": compiled="+averageCompiled+"ms interpreted="+averageInterpreted+"ms: compiled takes " + ((int)ratio)+"% of the interpreted time");
|
||||
if (averageCompiled>averageInterpreted) {
|
||||
fail("Compiled version took longer than interpreted! CompiledSpeed=~"+averageCompiled+
|
||||
"ms InterpretedSpeed="+averageInterpreted+"ms");
|
||||
@@ -690,7 +690,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
|
||||
if (noisyTests) {
|
||||
if (message!=null && message.length>0) {
|
||||
System.out.println(message[0]);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1968,7 +1968,8 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||
try {
|
||||
expr = new SpelExpressionParser().parseRaw("&@foo");
|
||||
fail("Illegal syntax, error expected");
|
||||
} catch (SpelParseException spe) {
|
||||
}
|
||||
catch (SpelParseException spe) {
|
||||
assertEquals(SpelMessage.INVALID_BEAN_REFERENCE,spe.getMessageCode());
|
||||
assertEquals(0,spe.getPosition());
|
||||
}
|
||||
@@ -1976,7 +1977,8 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||
try {
|
||||
expr = new SpelExpressionParser().parseRaw("@&foo");
|
||||
fail("Illegal syntax, error expected");
|
||||
} catch (SpelParseException spe) {
|
||||
}
|
||||
catch (SpelParseException spe) {
|
||||
assertEquals(SpelMessage.INVALID_BEAN_REFERENCE,spe.getMessageCode());
|
||||
assertEquals(0,spe.getPosition());
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ public class StandardTypeLocatorTests {
|
||||
try {
|
||||
locator.findType("URL");
|
||||
fail("Should have failed");
|
||||
} catch (EvaluationException ee) {
|
||||
}
|
||||
catch (EvaluationException ee) {
|
||||
SpelEvaluationException sEx = (SpelEvaluationException)ee;
|
||||
assertEquals(SpelMessage.TYPE_NOT_FOUND,sEx.getMessageCode());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -78,7 +78,8 @@ public class VariableAndFunctionTests extends AbstractExpressionTests {
|
||||
@SuppressWarnings("unused")
|
||||
Object v = parser.parseRaw("#notStatic()").getValue(ctx);
|
||||
fail("Should have failed with exception - cannot call non static method that way");
|
||||
} catch (SpelEvaluationException se) {
|
||||
}
|
||||
catch (SpelEvaluationException se) {
|
||||
if (se.getMessageCode() != SpelMessage.FUNCTION_MUST_BE_STATIC) {
|
||||
se.printStackTrace();
|
||||
fail("Should have failed a message about the function needing to be static, not: "
|
||||
@@ -86,6 +87,8 @@ public class VariableAndFunctionTests extends AbstractExpressionTests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this method is used by the test above
|
||||
public void nonStatic() {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -116,9 +116,10 @@ public class SpelParserTests {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
parser.parseRaw("new String");
|
||||
fail();
|
||||
} catch (ParseException e) {
|
||||
assertTrue(e instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) e;
|
||||
}
|
||||
catch (ParseException ex) {
|
||||
assertTrue(ex instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) ex;
|
||||
assertEquals(SpelMessage.MISSING_CONSTRUCTOR_ARGS, spe.getMessageCode());
|
||||
assertEquals(10, spe.getPosition());
|
||||
}
|
||||
@@ -127,9 +128,10 @@ public class SpelParserTests {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
parser.parseRaw("new String(3,");
|
||||
fail();
|
||||
} catch (ParseException e) {
|
||||
assertTrue(e instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) e;
|
||||
}
|
||||
catch (ParseException ex) {
|
||||
assertTrue(ex instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) ex;
|
||||
assertEquals(SpelMessage.RUN_OUT_OF_ARGUMENTS, spe.getMessageCode());
|
||||
assertEquals(10, spe.getPosition());
|
||||
}
|
||||
@@ -138,9 +140,10 @@ public class SpelParserTests {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
parser.parseRaw("new String(3");
|
||||
fail();
|
||||
} catch (ParseException e) {
|
||||
assertTrue(e instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) e;
|
||||
}
|
||||
catch (ParseException ex) {
|
||||
assertTrue(ex instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) ex;
|
||||
assertEquals(SpelMessage.RUN_OUT_OF_ARGUMENTS, spe.getMessageCode());
|
||||
assertEquals(10, spe.getPosition());
|
||||
}
|
||||
@@ -149,9 +152,10 @@ public class SpelParserTests {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
parser.parseRaw("new String(");
|
||||
fail();
|
||||
} catch (ParseException e) {
|
||||
assertTrue(e instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) e;
|
||||
}
|
||||
catch (ParseException ex) {
|
||||
assertTrue(ex instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) ex;
|
||||
assertEquals(SpelMessage.RUN_OUT_OF_ARGUMENTS, spe.getMessageCode());
|
||||
assertEquals(10, spe.getPosition());
|
||||
}
|
||||
@@ -160,9 +164,10 @@ public class SpelParserTests {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
parser.parseRaw("\"abc");
|
||||
fail();
|
||||
} catch (ParseException e) {
|
||||
assertTrue(e instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) e;
|
||||
}
|
||||
catch (ParseException ex) {
|
||||
assertTrue(ex instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) ex;
|
||||
assertEquals(SpelMessage.NON_TERMINATING_DOUBLE_QUOTED_STRING, spe.getMessageCode());
|
||||
assertEquals(0, spe.getPosition());
|
||||
}
|
||||
@@ -171,9 +176,10 @@ public class SpelParserTests {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
parser.parseRaw("'abc");
|
||||
fail();
|
||||
} catch (ParseException e) {
|
||||
assertTrue(e instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) e;
|
||||
}
|
||||
catch (ParseException ex) {
|
||||
assertTrue(ex instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) ex;
|
||||
assertEquals(SpelMessage.NON_TERMINATING_QUOTED_STRING, spe.getMessageCode());
|
||||
assertEquals(0, spe.getPosition());
|
||||
}
|
||||
@@ -274,7 +280,8 @@ public class SpelParserTests {
|
||||
try {
|
||||
new SpelExpressionParser().parseRaw("\"double quote: \\\"\\\".\"");
|
||||
fail("Should have failed");
|
||||
} catch (SpelParseException spe) {
|
||||
}
|
||||
catch (SpelParseException spe) {
|
||||
assertEquals(17, spe.getPosition());
|
||||
assertEquals(SpelMessage.UNEXPECTED_ESCAPE_CHAR, spe.getMessageCode());
|
||||
}
|
||||
@@ -401,9 +408,10 @@ public class SpelParserTests {
|
||||
Object o = expr.getValue();
|
||||
assertEquals(value, o);
|
||||
assertEquals(type, o.getClass());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
fail(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,9 +420,10 @@ public class SpelParserTests {
|
||||
SpelExpressionParser parser = new SpelExpressionParser();
|
||||
parser.parseRaw(expression);
|
||||
fail();
|
||||
} catch (ParseException e) {
|
||||
assertTrue(e instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) e;
|
||||
}
|
||||
catch (ParseException ex) {
|
||||
assertTrue(ex instanceof SpelParseException);
|
||||
SpelParseException spe = (SpelParseException) ex;
|
||||
assertEquals(expectedMessage, spe.getMessageCode());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user