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 013c37c54fb884dc0d183bcf947f06d2c8c590d7
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jun 1 18:39:50 2024 -0400

    Use assertThrows()
---
 src/test/java/org/apache/commons/jexl3/LexicalTest.java | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/commons/jexl3/LexicalTest.java 
b/src/test/java/org/apache/commons/jexl3/LexicalTest.java
index 6eaf6942..a65110b5 100644
--- a/src/test/java/org/apache/commons/jexl3/LexicalTest.java
+++ b/src/test/java/org/apache/commons/jexl3/LexicalTest.java
@@ -518,7 +518,7 @@ public class LexicalTest {
 
     @Test
     public void testContextualOptions0() {
-        final JexlFeatures f= new JexlFeatures();
+        final JexlFeatures f = new JexlFeatures();
         final JexlEngine jexl = new 
JexlBuilder().features(f).strict(true).create();
         final JexlEvalContext ctxt = new JexlEvalContext();
         final JexlOptions options = ctxt.getEngineOptions();
@@ -527,12 +527,7 @@ public class LexicalTest {
         options.setLexicalShade(true);
         ctxt.set("options", options);
         final JexlScript script = jexl.createScript("{var x = 42;} 
options.lexical = false; options.lexicalShade=false; x");
-        try {
-        final Object result = script.execute(ctxt);
-        fail("setting options.lexical should have no effect during execution");
-        } catch (final JexlException xf) {
-            assertNotNull(xf);
-        }
+        assertThrows(JexlException.class, () -> script.execute(ctxt), "setting 
options.lexical should have no effect during execution");
     }
 
     @Test

Reply via email to