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 6c5ead7bae32573a1b02a1692e861d13f93e15c4 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jun 1 14:57:10 2024 -0400 Use assertThrows() --- src/test/java/org/apache/commons/jexl3/IfTest.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/test/java/org/apache/commons/jexl3/IfTest.java b/src/test/java/org/apache/commons/jexl3/IfTest.java index ce4e4047..26ae06d1 100644 --- a/src/test/java/org/apache/commons/jexl3/IfTest.java +++ b/src/test/java/org/apache/commons/jexl3/IfTest.java @@ -18,8 +18,8 @@ package org.apache.commons.jexl3; import static org.junit.jupiter.api.Assertions.assertEquals; 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; import org.junit.jupiter.api.Test; @@ -307,16 +307,10 @@ public class IfTest extends JexlTestCase { final JexlEvalContext jc = new JexlEvalContext(); final JexlOptions options = jc.getEngineOptions(); final JexlExpression e = JEXL.createExpression("false ? bar : quux"); - Object o; options.setStrict(true); options.setSilent(false); - try { - o = e.evaluate(jc); - fail("Should have failed"); - } catch (final JexlException xjexl) { - // OK - assertTrue(xjexl.toString().contains("quux")); - } + final JexlException xjexl = assertThrows(JexlException.class, () -> e.evaluate(jc)); + assertTrue(xjexl.toString().contains("quux")); } /**
