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:28 UTC
(commons-jexl) 08/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 ff45141d776e9e6ee7aa4e7e3f907095d5573bb5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 18:15:53 2024 -0400
Use assertThrows()
---
src/test/java/org/apache/commons/jexl3/JexlTestCase.java | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/test/java/org/apache/commons/jexl3/JexlTestCase.java b/src/test/java/org/apache/commons/jexl3/JexlTestCase.java
index e7e2e637..1f7d1417 100644
--- a/src/test/java/org/apache/commons/jexl3/JexlTestCase.java
+++ b/src/test/java/org/apache/commons/jexl3/JexlTestCase.java
@@ -17,6 +17,7 @@
package org.apache.commons.jexl3;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import java.lang.reflect.Constructor;
@@ -153,13 +154,7 @@ public class JexlTestCase {
Class<JexlTestCase> clazz = null;
JexlTestCase test = null;
// find the class
- try {
- clazz = (Class<JexlTestCase>) Class.forName(testClassName);
- }
- catch (final ClassNotFoundException xclass) {
- fail("no such class: " + testClassName);
- return;
- }
+ assertThrows(ClassNotFoundException.class, () -> Class.forName(testClassName), () -> "no such class: " + testClassName);
// find ctor & instantiate
Constructor<JexlTestCase> ctor = null;
try {