dion 2004/08/19 23:08:54
Modified: jexl/src/test/org/apache/commons/jexl JexlTest.java
Log:
Add not tests
Revision Changes Path
1.45 +21 -34
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.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- JexlTest.java 19 Aug 2004 18:11:59 -0000 1.44
+++ JexlTest.java 20 Aug 2004 06:08:54 -0000 1.45
@@ -338,39 +338,26 @@
/*
* I can't believe anyone thinks this is a syntax.. :)
*/
-
- Expression e = ExpressionFactory.createExpression("empty nullthing");
- Object o = e.evaluate(jc);
- assertTrue("1 : o incorrect", o.equals(Boolean.TRUE));
-
- e = ExpressionFactory.createExpression("empty string");
- o = e.evaluate(jc);
- assertTrue("2 : o incorrect", o.equals(Boolean.TRUE));
-
- e = ExpressionFactory.createExpression("empty array");
- o = e.evaluate(jc);
- assertTrue("3 : o incorrect", o.equals(Boolean.TRUE));
-
- e = ExpressionFactory.createExpression("empty map");
- o = e.evaluate(jc);
- assertTrue("4 : o incorrect", o.equals(Boolean.TRUE));
-
- e = ExpressionFactory.createExpression("empty list");
- o = e.evaluate(jc);
- assertTrue("5 : o incorrect", o.equals(Boolean.TRUE));
-
- e = ExpressionFactory.createExpression("empty longstring");
- o = e.evaluate(jc);
- assertTrue("6 : o incorrect", o.equals(Boolean.FALSE));
-
- e = ExpressionFactory.createExpression("not empty longstring");
- o = e.evaluate(jc);
- assertTrue("7 : o incorrect", o.equals(Boolean.TRUE));
-
- e = ExpressionFactory.createExpression("empty set");
- o = e.evaluate(jc);
- assertTrue("8 : o incorrect", o.equals(Boolean.TRUE));
-
+ assertExpression(jc, "empty nullthing", Boolean.TRUE);
+ assertExpression(jc, "empty string", Boolean.TRUE);
+ assertExpression(jc, "empty array", Boolean.TRUE);
+ assertExpression(jc, "empty map", Boolean.TRUE);
+ assertExpression(jc, "empty set", Boolean.TRUE);
+ assertExpression(jc, "empty list", Boolean.TRUE);
+ assertExpression(jc, "empty longstring", Boolean.FALSE);
+ assertExpression(jc, "not empty longstring", Boolean.TRUE);
+ }
+
+ public void testNot() throws Exception
+ {
+ JexlContext jc = JexlHelper.createContext();
+ jc.getVars().put("string", "");
+ assertExpression(jc, "not empty string", Boolean.FALSE);
+ assertExpression(jc, "not(empty string)", Boolean.FALSE);
+ assertExpression(jc, "not empty(string)", Boolean.FALSE);
+ assertExpression(jc, "! empty string", Boolean.FALSE);
+ assertExpression(jc, "!(empty string)", Boolean.FALSE);
+ assertExpression(jc, "!empty(string)", Boolean.FALSE);
}
public void testSize()
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]