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 29bfb4edcb5dcf04fa8ddbeb4012ddbf34757ffb Author: Gary Gregory <[email protected]> AuthorDate: Sat Jun 1 18:02:40 2024 -0400 Use assertThrows() --- src/test/java/org/apache/commons/jexl3/IssuesTest.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/commons/jexl3/IssuesTest.java b/src/test/java/org/apache/commons/jexl3/IssuesTest.java index a24ffa7a..8cf23c08 100644 --- a/src/test/java/org/apache/commons/jexl3/IssuesTest.java +++ b/src/test/java/org/apache/commons/jexl3/IssuesTest.java @@ -19,6 +19,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.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -111,14 +112,8 @@ public class IssuesTest extends JexlTestCase { //"1000 / a" }; for (final String s : exprs) { - try { - final JexlExpression expr = jexl.createExpression(s); - /* Object value = */ - expr.evaluate(ctxt); - fail(s + " : should have failed due to null argument"); - } catch (final JexlException xjexl) { - // expected - } + final JexlExpression expr = jexl.createExpression(s); + assertThrows(JexlException.class, () -> expr.evaluate(ctxt), () -> s + " : should have failed due to null argument"); } }
