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/12/28 16:22:45 UTC

(commons-validator) 13/18: Use JUnit 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-validator.git

commit 3079918fd8808e925d86a488b9338169012cf9f3
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Dec 28 11:16:54 2024 -0500

    Use JUnit assertThrows()
---
 .../org/apache/commons/validator/routines/RegexValidatorTest.java  | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/validator/routines/RegexValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/RegexValidatorTest.java
index 00b6129e..0cb2564d 100644
--- a/src/test/java/org/apache/commons/validator/routines/RegexValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/RegexValidatorTest.java
@@ -75,12 +75,7 @@ public class RegexValidatorTest {
      */
     @Test
     public void testExceptions() {
-        final String invalidRegex = "^([abCD12]*$";
-        try {
-            new RegexValidator(invalidRegex);
-        } catch (final PatternSyntaxException e) {
-            // expected
-        }
+        assertThrows(PatternSyntaxException.class, () -> new RegexValidator("^([abCD12]*$"));
     }
 
     @Test