This is an automated email from the ASF dual-hosted git repository.
henrib pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git
The following commit(s) were added to refs/heads/master by this push:
new f044b83 JEXL-279: updated tests
f044b83 is described below
commit f044b83f26e17ac448369b91f0d7cfd6aa0b2e93
Author: henrib <[email protected]>
AuthorDate: Thu Dec 27 10:34:05 2018 +0100
JEXL-279: updated tests
---
.../org/apache/commons/jexl3/ExceptionTest.java | 13 +++++-----
.../java/org/apache/commons/jexl3/IssuesTest.java | 30 ----------------------
2 files changed, 6 insertions(+), 37 deletions(-)
diff --git a/src/test/java/org/apache/commons/jexl3/ExceptionTest.java
b/src/test/java/org/apache/commons/jexl3/ExceptionTest.java
index fc1b555..46b2770 100644
--- a/src/test/java/org/apache/commons/jexl3/ExceptionTest.java
+++ b/src/test/java/org/apache/commons/jexl3/ExceptionTest.java
@@ -118,8 +118,8 @@ public class ExceptionTest extends JexlTestCase {
}
}
-
// Unknown vars and properties versus null operands
+ // JEXL-73
@Test
public void testEx() throws Exception {
JexlEngine jexl = createEngine(false);
@@ -135,7 +135,7 @@ public class ExceptionTest extends JexlTestCase {
Assert.fail("c not defined as variable should throw");
} catch (JexlException.Variable xjexl) {
String msg = xjexl.getMessage();
- Assert.assertTrue(msg.indexOf("c") > 0);
+ Assert.assertTrue(msg.indexOf("variable c") > 0);
}
// disallow null operands
@@ -146,7 +146,7 @@ public class ExceptionTest extends JexlTestCase {
Assert.fail("c.e as null operand should throw");
} catch (JexlException.Variable xjexl) {
String msg = xjexl.getMessage();
- Assert.assertTrue(msg.indexOf("c.e") > 0);
+ Assert.assertTrue(msg.indexOf("variable c.e") > 0);
}
// allow null operands
@@ -166,7 +166,7 @@ public class ExceptionTest extends JexlTestCase {
Assert.fail("c.e not accessible as property should throw");
} catch (JexlException.Property xjexl) {
String msg = xjexl.getMessage();
- Assert.assertTrue(msg.indexOf("e") > 0);
+ Assert.assertTrue(msg.indexOf("property e") > 0);
}
}
@@ -215,7 +215,7 @@ public class ExceptionTest extends JexlTestCase {
Assert.fail("c not declared as variable should throw");
} catch (JexlException.Variable xjexl) {
String msg = xjexl.getMessage();
- Assert.assertTrue(msg.indexOf("c") > 0);
+ Assert.assertTrue(msg.indexOf("variable c") > 0);
}
// disallow null operands
@@ -226,11 +226,10 @@ public class ExceptionTest extends JexlTestCase {
Assert.fail("c.e as null operand should throw");
} catch (JexlException xjexl) {
String msg = xjexl.getMessage();
- Assert.assertTrue(msg.indexOf("c.e") > 0);
+ Assert.assertTrue(msg.indexOf("variable c.e") > 0);
}
}
-
@Test
public void test206() throws Exception {
String src = "null.1 = 2; return 42";
diff --git a/src/test/java/org/apache/commons/jexl3/IssuesTest.java
b/src/test/java/org/apache/commons/jexl3/IssuesTest.java
index a941fa2..7b8ebf8 100644
--- a/src/test/java/org/apache/commons/jexl3/IssuesTest.java
+++ b/src/test/java/org/apache/commons/jexl3/IssuesTest.java
@@ -254,36 +254,6 @@ public class IssuesTest extends JexlTestCase {
Assert.assertEquals(jexpr.toString(), null, jexpr.evaluate(ctxt)); //
OK
}
- // JEXL-73
- @Test
- public void test73() throws Exception {
- JexlEngine jexl = createEngine(false);
- JexlEvalContext ctxt = new JexlEvalContext();
- // ensure errors will throw
- ctxt.setSilent(false);
- ctxt.setStrict(true);
- JexlExpression e;
- e = jexl.createExpression("c.e");
- try {
- /* Object o = */ e.evaluate(ctxt);
- Assert.fail("c not declared as variable");
- } catch (JexlException.Variable xjexl) {
- String msg = xjexl.getMessage();
- Assert.assertTrue(msg.indexOf("c") > 0);
- }
-
- ctxt.set("c", "{ 'a' : 3, 'b' : 5}");
- ctxt.set("e", Integer.valueOf(2));
- try {
- /* Object o = */ e.evaluate(ctxt);
- Assert.fail("c.e not accessible as property");
- } catch (JexlException.Property xjexl) {
- String msg = xjexl.getMessage();
- Assert.assertTrue(msg.indexOf("e") > 0);
- }
-
- }
-
// JEXL-87
@Test
public void test87() throws Exception {