@ -106,9 +106,13 @@ public class ConstructorReference extends SpelNodeImpl {
@@ -106,9 +106,13 @@ public class ConstructorReference extends SpelNodeImpl {
@ -41,13 +41,17 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
@@ -41,13 +41,17 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
thrownewIllegalArgumentException("IllegalArgumentException for 1");
@ -55,6 +59,9 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
@@ -55,6 +59,9 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
if(i==2){
thrownewRuntimeException("RuntimeException for 2");
}
if(i==4){
thrownewTestException();
}
this.i=i;
}
@ -100,11 +107,11 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
@@ -100,11 +107,11 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
// 4 will make it throw a checked exception - this will be wrapped by spel on the way out
eContext.setVariable("bar",4);
try{
o=expr.getValue(eContext);
Assert.fail("Should have failed");
}catch(Exceptione){
// A problem occurred whilst attempting to construct an object of type 'org.springframework.expression.spel.ConstructorInvocationTests$Tester' using arguments '(java.lang.Integer)'
intidx=e.getMessage().indexOf("Tester");
@ -115,6 +122,22 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
@@ -115,6 +122,22 @@ public class ConstructorInvocationTests extends ExpressionTestCase {
}
// If counter is 4 then the method got called twice!
// 1 will make it throw a RuntimeException - SpEL will let this through
eContext.setVariable("bar",1);
try{
o=expr.getValue(eContext);
Assert.fail("Should have failed");
}catch(Exceptione){
// A problem occurred whilst attempting to construct an object of type 'org.springframework.expression.spel.ConstructorInvocationTests$Tester' using arguments '(java.lang.Integer)'
if(einstanceofSpelEvaluationException){
e.printStackTrace();
Assert.fail("Should not have been wrapped");
}
}
// If counter is 5 then the method got called twice!
@ -116,13 +116,32 @@ public class MethodInvocationTests extends ExpressionTestCase {
@@ -116,13 +116,32 @@ public class MethodInvocationTests extends ExpressionTestCase {
eContext.setVariable("bar",1);
try{
o=expr.getValue(eContext);
Assert.fail();
}catch(Exceptione){
e.printStackTrace();
if(einstanceofSpelEvaluationException){
e.printStackTrace();
Assert.fail("Should not be a SpelEvaluationException");
}
// normal
}
// If counter is 4 then the method got called twice!