restored default ognl behavior

This commit is contained in:
Keith Donald
2008-01-18 16:36:23 +00:00
parent b535dc7522
commit 166ba72062
5 changed files with 44 additions and 11 deletions

View File

@@ -30,6 +30,16 @@ public class ELExpressionParserTests extends TestCase {
assertEquals(new Long(7), exp.getValue(null));
}
public void testParseNullExpressionString() {
String expressionString = null;
try {
parser.parseExpression(expressionString, null);
fail("should have thrown iae");
} catch (IllegalArgumentException e) {
}
}
public void testParseSimpleEvalExpressionNoEvalContextWithTypeCoersion() {
String expressionString = "#{3 + 4}";
Expression exp = parser.parseExpression(expressionString, new ParserContextImpl().expect(Integer.class));

View File

@@ -33,6 +33,16 @@ public class OgnlExpressionParserTests extends TestCase {
public void testParseSimple() {
String exp = "${flag}";
assertTrue(parser.isDelimitedExpression(exp));
Expression e = parser.parseExpression(exp, null);
assertNotNull(e);
Boolean b = (Boolean) e.getValue(bean);
assertFalse(b.booleanValue());
}
public void testParseSimpleNotDelimited() {
String exp = "flag";
assertFalse(parser.isDelimitedExpression(exp));
Expression e = parser.parseExpression(exp, null);
assertNotNull(e);
Boolean b = (Boolean) e.getValue(bean);