You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/06/01 23:28:27 UTC
(commons-jexl) 07/40: Use assertThrows()
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 af164de23d35d407fb353cd7cdea5a1af05f346a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 18:07:57 2024 -0400
Use assertThrows()
---
src/test/java/org/apache/commons/jexl3/JexlTest.java | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/test/java/org/apache/commons/jexl3/JexlTest.java b/src/test/java/org/apache/commons/jexl3/JexlTest.java
index 902aec46..a6a8d024 100644
--- a/src/test/java/org/apache/commons/jexl3/JexlTest.java
+++ b/src/test/java/org/apache/commons/jexl3/JexlTest.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.assertFalse;
+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.math.BigDecimal;
import java.math.BigInteger;
@@ -160,12 +160,7 @@ public final class JexlTest extends JexlTestCase {
*/
@Test
public void testBadParse() throws Exception {
- try {
- assertExpression(new MapContext(), "empty()", null);
- fail("Bad expression didn't throw ParseException");
- } catch (final JexlException pe) {
- // expected behavior
- }
+ assertThrows(JexlException.class, () -> assertExpression(new MapContext(), "empty()", null));
}
/**