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 983e331730ef33ed36a4e9d9b62f17c577a73356 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jun 1 15:14:11 2024 -0400 Use assertThrows() --- src/test/java/org/apache/commons/jexl3/Issues200Test.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/apache/commons/jexl3/Issues200Test.java b/src/test/java/org/apache/commons/jexl3/Issues200Test.java index 2d640afe..e9e11f1f 100644 --- a/src/test/java/org/apache/commons/jexl3/Issues200Test.java +++ b/src/test/java/org/apache/commons/jexl3/Issues200Test.java @@ -592,14 +592,9 @@ public class Issues200Test extends JexlTestCase { final JexlContext ctxt = new MapContext(); ctxt.set("out", System.out); final JexlEngine jexl = new JexlBuilder().strict(true).safe(true).create(); - final JexlScript e = jexl.createScript("out.println(xyz)"); - try { - final Object o = e.execute(ctxt); - fail("should have thrown"); - } catch (final JexlException.Variable xvar) { - assertEquals("xyz", xvar.getVariable()); - } + final JexlException.Variable xvar = assertThrows(JexlException.Variable.class, () -> e.execute(ctxt)); + assertEquals("xyz", xvar.getVariable()); } @Test
