cause linking tests and improvements
This commit is contained in:
@@ -17,6 +17,7 @@ package org.springframework.binding.expression.ognl;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.binding.expression.EvaluationException;
|
||||
import org.springframework.binding.expression.Expression;
|
||||
import org.springframework.binding.expression.ExpressionVariable;
|
||||
import org.springframework.binding.expression.ParserException;
|
||||
@@ -215,4 +216,24 @@ public class OgnlExpressionParserTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testReasonCauseLinkingGetValue() {
|
||||
String exp = "getException()";
|
||||
Expression e = parser.parseExpression(exp, null);
|
||||
try {
|
||||
e.getValue(bean);
|
||||
} catch (EvaluationException ex) {
|
||||
assertTrue(ex.getCause().getCause() instanceof IllegalStateException);
|
||||
}
|
||||
}
|
||||
|
||||
public void testReasonCauseLinkingSetValue() {
|
||||
String exp = "exceptionProperty";
|
||||
Expression e = parser.parseExpression(exp, null);
|
||||
try {
|
||||
e.setValue(bean, "does not matter");
|
||||
} catch (EvaluationException ex) {
|
||||
assertTrue(ex.getCause().getCause() instanceof IllegalStateException);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,4 +61,12 @@ public class TestBean {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Exception getException() {
|
||||
throw new IllegalStateException("Test");
|
||||
}
|
||||
|
||||
public void setExceptionProperty(String whatever) {
|
||||
throw new IllegalStateException("Test");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user