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 61888724718f20b874f0ab33545c93f60ab3a87e Author: Gary Gregory <[email protected]> AuthorDate: Sat Jun 1 14:31:19 2024 -0400 Use assertThrows() --- .../apache/commons/jexl3/ContextNamespaceTest.java | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java b/src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java index 62ab5b01..ae54830f 100644 --- a/src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java +++ b/src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java @@ -17,8 +17,7 @@ package org.apache.commons.jexl3; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; - +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -357,20 +356,8 @@ public class ContextNamespaceTest extends JexlTestCase { assertEquals(18.6d, (Double) ctxt.get("VAT"), 0.0001d); ctxt.set("VAT", 20.0d); assertEquals(20.0d, (Double) ctxt.get("VAT"), 0.0001d); - - try { - ctxt.get("vat"); - fail("should have failed"); - } catch (final JexlException.Property xprop) { - // - } - - try { - ctxt.set("vat", 33.0d); - fail("should have failed"); - } catch (final JexlException.Property xprop) { - // - } + assertThrows(JexlException.Property.class, () -> ctxt.get("vat")); + assertThrows(JexlException.Property.class, () -> ctxt.set("vat", 33.0d)); } @Test
