Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 41869 invoked from network); 20 Aug 2004 07:56:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 20 Aug 2004 07:56:39 -0000 Received: (qmail 25719 invoked by uid 500); 20 Aug 2004 07:56:35 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 25634 invoked by uid 500); 20 Aug 2004 07:56:34 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 25619 invoked by uid 500); 20 Aug 2004 07:56:34 -0000 Received: (qmail 25615 invoked by uid 99); 20 Aug 2004 07:56:34 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Fri, 20 Aug 2004 00:56:33 -0700 Received: (qmail 41817 invoked by uid 1431); 20 Aug 2004 07:56:33 -0000 Date: 20 Aug 2004 07:56:33 -0000 Message-ID: <20040820075633.41816.qmail@minotaur.apache.org> From: dion@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/jexl/src/test/org/apache/commons/jexl JexlTest.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N dion 2004/08/20 00:56:33 Modified: jexl/src/test/org/apache/commons/jexl JexlTest.java Log: Use assertExpression more often Revision Changes Path 1.49 +17 -55 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.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- JexlTest.java 20 Aug 2004 07:51:48 -0000 1.48 +++ JexlTest.java 20 Aug 2004 07:56:33 -0000 1.49 @@ -239,18 +239,6 @@ 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() throws Exception @@ -406,57 +394,31 @@ public void testNotConditions() throws Exception { - Expression e = ExpressionFactory.createExpression("!x"); JexlContext jc = JexlHelper.createContext(); Foo foo = new Foo(); jc.getVars().put("x", Boolean.TRUE ); jc.getVars().put("foo", foo ); jc.getVars().put("bar", "true" ); - Object o = e.evaluate(jc); - - assertTrue("o not instanceof Boolean", o instanceof Boolean); - assertEquals("o incorrect", Boolean.FALSE, o); - - e = ExpressionFactory.createExpression("x"); - o = e.evaluate(jc); - - assertEquals("o incorrect", Boolean.TRUE, o ); - - e = ExpressionFactory.createExpression("!bar"); - o = e.evaluate(jc); - - assertEquals("o incorrect", Boolean.FALSE, o ); - - e = ExpressionFactory.createExpression("!foo.isSimple()"); - o = e.evaluate(jc); - assertEquals("o incorrect", Boolean.FALSE, o ); + assertExpression(jc, "!x", Boolean.FALSE); + assertExpression(jc, "x", Boolean.TRUE); + assertExpression(jc, "!bar", Boolean.FALSE); + assertExpression(jc, "!foo.isSimple()", Boolean.FALSE); + assertExpression(jc, "foo.isSimple()", Boolean.TRUE); + assertExpression(jc, "!foo.simple", Boolean.FALSE); + assertExpression(jc, "foo.simple", Boolean.TRUE); + assertExpression(jc, "foo.getCheeseList().size() == 3", Boolean.TRUE); + assertExpression(jc, "foo.cheeseList.size() == 3", Boolean.TRUE); - e = ExpressionFactory.createExpression("foo.isSimple()"); - o = e.evaluate(jc); - - assertEquals("o incorrect", Boolean.TRUE, o ); - - e = ExpressionFactory.createExpression("!foo.simple"); - o = e.evaluate(jc); - - assertEquals("o incorrect", Boolean.FALSE, o ); - - e = ExpressionFactory.createExpression("foo.simple"); - o = e.evaluate(jc); - - assertEquals("o incorrect", Boolean.TRUE, o ); - - e = ExpressionFactory.createExpression("foo.getCheeseList().size() == 3"); - o = e.evaluate(jc); - - assertEquals("o incorrect", Boolean.TRUE, o ); - - e = ExpressionFactory.createExpression("foo.cheeseList.size() == 3"); - o = e.evaluate(jc); + 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); - assertEquals("o incorrect", Boolean.TRUE, o ); } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org