This commit is contained in:
Keith Donald
2008-08-08 20:56:54 +00:00
parent c4726f59c2
commit 408fc13e2a
7 changed files with 52 additions and 34 deletions

View File

@@ -131,6 +131,13 @@ public class ELExpressionParserTests extends TestCase {
assertEquals("foo2bar", exp.getValue(target));
}
public void testGetValueTypeNullCollectionValue() {
String exp = "list[3]";
Expression e = parser.parseExpression(exp, null);
TestBean target = new TestBean();
assertEquals(null, e.getValueType(target));
}
public static class TestBean {
private String value = "foo";
@@ -153,6 +160,7 @@ public class ELExpressionParserTests extends TestCase {
list.add("1");
list.add("2");
list.add("3");
list.add(null);
}
public TestBean getBean() {
@@ -178,6 +186,10 @@ public class ELExpressionParserTests extends TestCase {
public void setMaximum(int maximum) {
this.maximum = maximum;
}
public List getList() {
return list;
}
}
private static class TestELContextFactory implements ELContextFactory {

View File

@@ -160,4 +160,10 @@ public class OgnlExpressionParserTests extends TestCase {
Expression e = parser.parseExpression(exp, null);
assertEquals(boolean.class, e.getValueType(bean));
}
public void testGetValueTypeNullCollectionValue() {
String exp = "list[0]";
Expression e = parser.parseExpression(exp, null);
assertEquals(null, e.getValueType(bean));
}
}