dion 2004/08/19 10:35:47
Modified: jexl/src/test/org/apache/commons/jexl JexlTest.java
Log:
Add a test for parse exception throwing
Revision Changes Path
1.42 +19 -1
jakarta-commons/jexl/src/test/org/apache/commons/jexl/JexlTest.java
Index: JexlTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/jexl/src/test/org/apache/commons/jexl/JexlTest.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- JexlTest.java 18 Aug 2004 07:03:34 -0000 1.41
+++ JexlTest.java 19 Aug 2004 17:35:47 -0000 1.42
@@ -28,6 +28,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.commons.jexl.parser.ParseException;
import org.apache.commons.jexl.resolver.FlatResolver;
/**
@@ -1096,6 +1097,23 @@
JexlContext jc = JexlHelper.createContext();
jc.getVars().put("aBool", Boolean.FALSE);
assertExpression(jc, "aBool.valueOf('true')", Boolean.TRUE);
+ }
+
+ /**
+ * Make sure bad syntax throws ParseException
+ * @throws Exception on errors
+ */
+ public void testBadParse() throws Exception
+ {
+ try
+ {
+ JexlContext jc = JexlHelper.createContext();
+ Expression e = ExpressionFactory.createExpression("empty()");
+ }
+ catch (ParseException pe)
+ {
+ System.err.println("Expecting a parse exception: " + pe.getMessage());
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]