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 1e50f15f9a71d27e3218d9859b813025ebac1a83
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Oct 1 13:27:07 2024 -0400

    Use assertThrows()
---
 .../commons/validator/routines/DomainValidatorStartupTest.java    | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/validator/routines/DomainValidatorStartupTest.java
 
b/src/test/java/org/apache/commons/validator/routines/DomainValidatorStartupTest.java
index 351d466e..d92c412e 100644
--- 
a/src/test/java/org/apache/commons/validator/routines/DomainValidatorStartupTest.java
+++ 
b/src/test/java/org/apache/commons/validator/routines/DomainValidatorStartupTest.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -46,12 +45,7 @@ public class DomainValidatorStartupTest {
         DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, "ch"); // OK
         final DomainValidator dv = DomainValidator.getInstance();
         assertNotNull(dv);
-        try {
-            DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, "ch");
-            fail("Expected IllegalStateException");
-        } catch (final IllegalStateException ise) {
-            // expected
-        }
+        assertThrows(IllegalStateException.class, () -> 
DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, "ch"));
     }
 
     @Test

Reply via email to