This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git

commit 963ef9642be77fa0ed61c18e7b5e934757829f76
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Jun 1 18:05:26 2024 -0400

    Use assertThrows()
---
 src/test/java/org/apache/commons/jexl3/IssuesTest.java | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/test/java/org/apache/commons/jexl3/IssuesTest.java 
b/src/test/java/org/apache/commons/jexl3/IssuesTest.java
index bdbf2891..08ddcf89 100644
--- a/src/test/java/org/apache/commons/jexl3/IssuesTest.java
+++ b/src/test/java/org/apache/commons/jexl3/IssuesTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.jexl3;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -203,15 +204,9 @@ public class IssuesTest extends JexlTestCase {
         // ensure errors will throw
         options.setStrict(true);
         options.setSilent(false);
-        try {
-            final String jexlExp = "(foo.getInner().foo() eq true) and 
(foo.getInner().goo() = (foo.getInner().goo()+1-1))";
-            final JexlExpression e = jexl.createExpression(jexlExp);
-            jc.set("foo", new Foo());
-            /* Object o = */ e.evaluate(jc);
-            fail("Should have failed due to invalid assignment");
-        } catch (final JexlException.Assignment xparse) {
-            final String dbg = xparse.toString();
-        }
+        final String jexlExp = "(foo.getInner().foo() eq true) and 
(foo.getInner().goo() = (foo.getInner().goo()+1-1))";
+        jc.set("foo", new Foo());
+        assertNotNull(assertThrows(JexlException.Assignment.class, () -> 
jexl.createExpression(jexlExp)).toString());
     }
 
     // JEXL-49: blocks not parsed (fixed)

Reply via email to