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 60e5a437b17a4f6bafe881152560a77b3abd22a3 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jun 1 18:01:10 2024 -0400 Use assertThrows() --- src/test/java/org/apache/commons/jexl3/Issues400Test.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/apache/commons/jexl3/Issues400Test.java b/src/test/java/org/apache/commons/jexl3/Issues400Test.java index c49557b0..812c1ca3 100644 --- a/src/test/java/org/apache/commons/jexl3/Issues400Test.java +++ b/src/test/java/org/apache/commons/jexl3/Issues400Test.java @@ -24,7 +24,6 @@ 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; -import static org.junit.jupiter.api.Assertions.fail; import java.lang.reflect.Method; import java.math.BigDecimal; @@ -120,7 +119,7 @@ public class Issues400Test { @Test public void test403() { // @formatter:off - final String[] strings = new String[]{ + final String[] strings = { " map1.`${item.a}` = 1;\n", " map1[`${item.a}`] = 1;\n", " map1[item.a] = 1;\n" @@ -375,11 +374,10 @@ public class Issues400Test { assertTrue(result.get() >= now); // we still cant call anything else - try { - jexl.createScript("sns:gc()").execute(null); - } catch (final JexlException.Method method) { - assertEquals("gc", method.getMethod()); - } + final JexlScript script = jexl.createScript("sns:gc()"); + final JexlException.Method method = assertThrows(JexlException.Method.class, () -> script.execute(null)); + assertEquals("gc", method.getMethod()); + } @Test