Author: sebb
Date: Fri Dec 2 23:06:49 2011
New Revision: 1209771
URL: http://svn.apache.org/viewvc?rev=1209771&view=rev
Log:
Minimal fixes to tests
- message format changes
- change assertion so failure reason is clear
Modified:
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/IssuesTest.java
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/UnifiedJEXLTest.java
Modified:
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java?rev=1209771&r1=1209770&r2=1209771&view=diff
==============================================================================
---
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java
(original)
+++
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java
Fri Dec 2 23:06:49 2011
@@ -78,7 +78,7 @@ public class ArithmeticTest extends Jexl
public void testNullOperand() throws Exception {
asserter.setVariable("right", null);
asserter.failExpression("~right", ".*null.*");
- asserter.failExpression("-right", ".*number.*");
+ asserter.failExpression("-right", ".*arithmetic.*"); // 2.1- new
message
}
public void testBigDecimal() throws Exception {
Modified:
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/IssuesTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/IssuesTest.java?rev=1209771&r1=1209770&r2=1209771&view=diff
==============================================================================
---
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/IssuesTest.java
(original)
+++
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/IssuesTest.java
Fri Dec 2 23:06:49 2011
@@ -250,7 +250,7 @@ public class IssuesTest extends JexlTest
/* Object o = */ e.evaluate(ctxt);
} catch (JexlException xjexl) {
String msg = xjexl.getMessage();
- assertTrue(msg.indexOf("variable c.e") > 0);
+ assertTrue("Unexpected: '"+msg+"'", msg.indexOf("c.e") > 0); //
2.1 - new message
}
}
Modified:
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/UnifiedJEXLTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/UnifiedJEXLTest.java?rev=1209771&r1=1209770&r2=1209771&view=diff
==============================================================================
---
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/UnifiedJEXLTest.java
(original)
+++
commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/UnifiedJEXLTest.java
Fri Dec 2 23:06:49 2011
@@ -105,7 +105,7 @@ public class UnifiedJEXLTest extends Jex
vars.put("name", "Doe");
UnifiedJEXL.Expression phase1 = expr.prepare(context);
String as = phase1.asString();
- assertEquals("Dear #{p} Doe;", as);
+ assertEquals("Dear ${p} Doe;", as); // 2.1 deferred expressions are
resolved in prepare phase
vars.put("p", "Mr");
vars.put("name", "Should not be used in 2nd phase");
Object o = phase1.evaluate(context);
@@ -125,7 +125,7 @@ public class UnifiedJEXLTest extends Jex
public void testImmediate() throws Exception {
JexlContext none = null;
UnifiedJEXL.Expression expr = EL.parse("${'Hello ' + 'World!'}");
- assertTrue("prepare should return same expression", expr.prepare(none)
== expr);
+ assertSame("prepare should return same expression", expr,
expr.prepare(none)); // 2.1 currently fails
Object o = expr.evaluate(none);
assertTrue("expression should be immediate", expr.isImmediate());
assertEquals("Hello World!", o);
@@ -143,7 +143,7 @@ public class UnifiedJEXLTest extends Jex
public void testDeferred() throws Exception {
JexlContext none = null;
UnifiedJEXL.Expression expr = EL.parse("#{'world'}");
- assertTrue("prepare should return same expression", expr.prepare(none)
== expr);
+ assertSame("prepare should return same expression", expr,
expr.prepare(none)); // 2.1 currently fails
Object o = expr.evaluate(none);
assertTrue("expression should be deferred", expr.isDeferred());
assertEquals("world", o);