commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r391599 - /jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java
Date Wed, 05 Apr 2006 12:21:47 GMT
Author: dion
Date: Wed Apr  5 05:21:46 2006
New Revision: 391599

URL: http://svn.apache.org/viewcvs?rev=391599&view=rev
Log:
Add postResolver test

Modified:
    jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java

Modified: jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java?rev=391599&r1=391598&r2=391599&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java Wed Apr
 5 05:21:46 2006
@@ -81,7 +81,7 @@
         Object o = e.evaluate(jc);
 
         assertTrue("o not instanceof String", o instanceof String);
-        assertTrue("o incorrect", o.equals(GET_METHOD_STRING));
+        assertEquals("o incorrect", GET_METHOD_STRING, o);
     }
 
     /**
@@ -745,47 +745,40 @@
          * first, a simple override
          */
 
-        Expression expr =
-            ExpressionFactory.createExpression("foo.bar");
-
+        Expression expr = ExpressionFactory.createExpression("foo.bar");
         expr.addPreResolver(new FlatResolver());
 
         JexlContext jc = JexlHelper.createContext();
-
         Foo foo = new Foo();
-
         jc.getVars().put("foo.bar", "flat value");
         jc.getVars().put("foo", foo );
 
         Object o = expr.evaluate(jc);
-
-        assertEquals("flat override", o,"flat value");
+        assertEquals("flat override", "flat value", o);
 
         /*
          * now, let the resolver not find it and have it drop to jexl
          */
-
-        expr =
-            ExpressionFactory.createExpression("foo.bar.length()");
-
+        expr = ExpressionFactory.createExpression("foo.bar.length()");
         expr.addPreResolver(new FlatResolver());
-
         o = expr.evaluate(jc);
-
-        assertEquals("flat override 1", o,new Integer(GET_METHOD_STRING.length()));
+        assertEquals("flat override 1", new Integer(GET_METHOD_STRING.length()), o);
 
         /*
          * now, let the resolver not find it and NOT drop to jexl
          */
 
-        expr =
-            ExpressionFactory.createExpression("foo.bar.length()");
-
+        expr = ExpressionFactory.createExpression("foo.bar.length()");
         expr.addPreResolver(new FlatResolver(false));
-
         o = expr.evaluate(jc);
-
         assertEquals("flat override 2", o, null);
+        
+        // now for a post resolver
+        expr = ExpressionFactory.createExpression("foo.bar.baz");
+        Long result = new Long(1);
+        jc.getVars().put("foo.bar.baz", result);
+        expr.addPostResolver(new FlatResolver());
+        assertEquals("flat override", result, expr.evaluate(jc));
 
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message