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


The following commit(s) were added to refs/heads/master by this push:
     new aaffbb45 Sort members
aaffbb45 is described below

commit aaffbb4508159100752bc68954c55acce20326cd
Author: Gary Gregory <[email protected]>
AuthorDate: Sun May 5 11:17:46 2024 -0400

    Sort members
---
 .../org/apache/commons/validator/EmailTest.java    | 164 ++++++++++-----------
 .../apache/commons/validator/ExceptionTest.java    |  50 +++----
 .../validator/routines/DomainValidatorTest.java    |  42 +++---
 .../validator/routines/EmailValidatorTest.java     |  24 +--
 4 files changed, 140 insertions(+), 140 deletions(-)

diff --git a/src/test/java/org/apache/commons/validator/EmailTest.java 
b/src/test/java/org/apache/commons/validator/EmailTest.java
index 5718d5fc..d1531414 100644
--- a/src/test/java/org/apache/commons/validator/EmailTest.java
+++ b/src/test/java/org/apache/commons/validator/EmailTest.java
@@ -84,6 +84,76 @@ public class EmailTest extends AbstractCommonTest {
             new ResultPair("abigail@", false), new ResultPair("@example.com", 
false),
             new ResultPair("phrase: [email protected] [email protected] 
;", false), new ResultPair("invalid�[email protected]", false) };
 
+    /**
+     * Load <code>ValidatorResources</code> from validator-regexp.xml.
+     */
+    @BeforeEach
+    protected void setUp() throws IOException, SAXException {
+        loadResources("EmailTest-config.xml");
+    }
+
+    /**
+     * Tests the e-mail validation.
+     */
+    @Test
+    public void testEmail() throws ValidatorException {
+        // Create bean to run test on.
+        final ValueBean info = new ValueBean();
+
+        info.setValue("[email protected]");
+        valueTest(info, true);
+    }
+
+    /**
+     * Tests the e-mail validation with a user at a TLD
+     */
+    @Test
+    public void testEmailAtTLD() throws ValidatorException {
+        // Create bean to run test on.
+        final ValueBean info = new ValueBean();
+
+        info.setValue("m@de");
+        valueTest(info, false);
+
+        final org.apache.commons.validator.routines.EmailValidator validator = 
org.apache.commons.validator.routines.EmailValidator.getInstance(true, true);
+        final boolean result = validator.isValid("m@de");
+        assertTrue(result, "Result should have been true");
+
+    }
+
+    /**
+     * Tests the e-mail validation.
+     */
+    @Test
+    public void testEmailExtension() throws ValidatorException {
+        // Create bean to run test on.
+        final ValueBean info = new ValueBean();
+
+        info.setValue("[email protected]");
+        valueTest(info, true);
+
+        info.setValue("[email protected]");
+        valueTest(info, true);
+
+        info.setValue("[email protected]");
+        valueTest(info, true);
+
+        info.setValue("[email protected]");
+        valueTest(info, true);
+
+        info.setValue("jsmith@apache.");
+        valueTest(info, false);
+
+        info.setValue("[email protected]");
+        valueTest(info, false);
+
+        info.setValue("[email protected]");
+        valueTest(info, true);
+
+        info.setValue("[email protected]");
+        valueTest(info, false);
+    }
+
     /**
      * Write this test based on perl Mail::RFC822::Address which takes its 
example email address directly from RFC822
      *
@@ -100,6 +170,18 @@ public class EmailTest extends AbstractCommonTest {
         }
     }
 
+    /**
+     * Test that @localhost and @localhost.localdomain addresses aren't 
declared valid by default
+     */
+    @Test
+    public void testEmailLocalhost() throws ValidatorException {
+        final ValueBean info = new ValueBean();
+        info.setValue("joe@localhost");
+        valueTest(info, false);
+        info.setValue("[email protected]");
+        valueTest(info, false);
+    }
+
     /**
      * Write this test according to parts of RFC, as opposed to the type of 
character that is being tested.
      *
@@ -179,88 +261,6 @@ public class EmailTest extends AbstractCommonTest {
 
     }
 
-    /**
-     * Load <code>ValidatorResources</code> from validator-regexp.xml.
-     */
-    @BeforeEach
-    protected void setUp() throws IOException, SAXException {
-        loadResources("EmailTest-config.xml");
-    }
-
-    /**
-     * Tests the e-mail validation.
-     */
-    @Test
-    public void testEmail() throws ValidatorException {
-        // Create bean to run test on.
-        final ValueBean info = new ValueBean();
-
-        info.setValue("[email protected]");
-        valueTest(info, true);
-    }
-
-    /**
-     * Tests the e-mail validation with a user at a TLD
-     */
-    @Test
-    public void testEmailAtTLD() throws ValidatorException {
-        // Create bean to run test on.
-        final ValueBean info = new ValueBean();
-
-        info.setValue("m@de");
-        valueTest(info, false);
-
-        final org.apache.commons.validator.routines.EmailValidator validator = 
org.apache.commons.validator.routines.EmailValidator.getInstance(true, true);
-        final boolean result = validator.isValid("m@de");
-        assertTrue(result, "Result should have been true");
-
-    }
-
-    /**
-     * Tests the e-mail validation.
-     */
-    @Test
-    public void testEmailExtension() throws ValidatorException {
-        // Create bean to run test on.
-        final ValueBean info = new ValueBean();
-
-        info.setValue("[email protected]");
-        valueTest(info, true);
-
-        info.setValue("[email protected]");
-        valueTest(info, true);
-
-        info.setValue("[email protected]");
-        valueTest(info, true);
-
-        info.setValue("[email protected]");
-        valueTest(info, true);
-
-        info.setValue("jsmith@apache.");
-        valueTest(info, false);
-
-        info.setValue("[email protected]");
-        valueTest(info, false);
-
-        info.setValue("[email protected]");
-        valueTest(info, true);
-
-        info.setValue("[email protected]");
-        valueTest(info, false);
-    }
-
-    /**
-     * Test that @localhost and @localhost.localdomain addresses aren't 
declared valid by default
-     */
-    @Test
-    public void testEmailLocalhost() throws ValidatorException {
-        final ValueBean info = new ValueBean();
-        info.setValue("joe@localhost");
-        valueTest(info, false);
-        info.setValue("[email protected]");
-        valueTest(info, false);
-    }
-
     /**
      * Tests the e-mail validation with an RCS-noncompliant character in the 
address.
      */
diff --git a/src/test/java/org/apache/commons/validator/ExceptionTest.java 
b/src/test/java/org/apache/commons/validator/ExceptionTest.java
index e5ae760c..fd0ef364 100644
--- a/src/test/java/org/apache/commons/validator/ExceptionTest.java
+++ b/src/test/java/org/apache/commons/validator/ExceptionTest.java
@@ -49,31 +49,6 @@ public class ExceptionTest extends AbstractCommonTest {
         loadResources("ExceptionTest-config.xml");
     }
 
-    /**
-     * Tests handling of checked exceptions - should become 
ValidatorExceptions.
-     */
-    @Test
-    public void testValidatorException() {
-        // Create bean to run test on.
-        final ValueBean info = new ValueBean();
-        info.setValue("VALIDATOR");
-
-        // Construct validator based on the loaded resources
-        // and the form key
-        final Validator validator = new Validator(resources, FORM_KEY);
-        // add the name bean to the validator as a resource
-        // for the validations to be performed on.
-        validator.setParameter(Validator.BEAN_PARAM, info);
-
-        // Get results of the validation which can throw ValidatorException
-        try {
-            validator.validate();
-            fail("ValidatorException should occur here!");
-        } catch (final ValidatorException expected) {
-            assertTrue("VALIDATOR-EXCEPTION".equals(expected.getMessage()));
-        }
-    }
-
     /**
      * Tests handling of checked exceptions - should become 
ValidatorExceptions.
      *
@@ -142,4 +117,29 @@ public class ExceptionTest extends AbstractCommonTest {
             // assertTrue("RUNTIME-EXCEPTION".equals(expected.getMessage()));
         }
     }
+
+    /**
+     * Tests handling of checked exceptions - should become 
ValidatorExceptions.
+     */
+    @Test
+    public void testValidatorException() {
+        // Create bean to run test on.
+        final ValueBean info = new ValueBean();
+        info.setValue("VALIDATOR");
+
+        // Construct validator based on the loaded resources
+        // and the form key
+        final Validator validator = new Validator(resources, FORM_KEY);
+        // add the name bean to the validator as a resource
+        // for the validations to be performed on.
+        validator.setParameter(Validator.BEAN_PARAM, info);
+
+        // Get results of the validation which can throw ValidatorException
+        try {
+            validator.validate();
+            fail("ValidatorException should occur here!");
+        } catch (final ValidatorException expected) {
+            assertTrue("VALIDATOR-EXCEPTION".equals(expected.getMessage()));
+        }
+    }
 }
diff --git 
a/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java 
b/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
index f8a6a7a3..92531bc5 100644
--- 
a/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
+++ 
b/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
@@ -378,27 +378,6 @@ public class DomainValidatorTest {
         validator = DomainValidator.getInstance();
     }
 
-    // Check array is sorted and is lower-case
-    @Test
-    public void testCountryCodeTldsSortedAndLowerCase() throws Exception {
-        final boolean sorted = isSortedLowerCase("COUNTRY_CODE_TLDS");
-        assertTrue(sorted);
-    }
-
-    // Check array is sorted and is lower-case
-    @Test
-    public void testGenericTldsSortedAndLowerCase() throws Exception {
-        final boolean sorted = isSortedLowerCase("GENERIC_TLDS");
-        assertTrue(sorted);
-    }
-
-    // Check array is sorted and is lower-case
-    @Test
-    public void testInfrastructureTldsSortedAndLowerCase() throws Exception {
-        final boolean sorted = isSortedLowerCase("INFRASTRUCTURE_TLDS");
-        assertTrue(sorted);
-    }
-
     // Check array is sorted and is lower-case
     @Test
     public void tesLocalTldsSortedAndLowerCase() throws Exception {
@@ -429,6 +408,13 @@ public class DomainValidatorTest {
         assertFalse(allowLocal.isValid(" apache.org "), "domain name with 
spaces shouldn't validate");
     }
 
+    // Check array is sorted and is lower-case
+    @Test
+    public void testCountryCodeTldsSortedAndLowerCase() throws Exception {
+        final boolean sorted = isSortedLowerCase("COUNTRY_CODE_TLDS");
+        assertTrue(sorted);
+    }
+
     @Test
     public void testDomainNoDots() { // rfc1123
         assertTrue(validator.isValidDomainSyntax("a"), "a (alpha) should 
validate");
@@ -445,6 +431,13 @@ public class DomainValidatorTest {
         
assertTrue(Modifier.isPublic(DomainValidator.ArrayType.class.getModifiers()));
     }
 
+    // Check array is sorted and is lower-case
+    @Test
+    public void testGenericTldsSortedAndLowerCase() throws Exception {
+        final boolean sorted = isSortedLowerCase("GENERIC_TLDS");
+        assertTrue(sorted);
+    }
+
     @Test
     public void testGetArray() {
         
assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_MINUS));
@@ -477,6 +470,13 @@ public class DomainValidatorTest {
         assertFalse(validator.isValid("www.\uFFFD.ch"), "www.\uFFFD.ch FFFD 
should fail");
     }
 
+    // Check array is sorted and is lower-case
+    @Test
+    public void testInfrastructureTldsSortedAndLowerCase() throws Exception {
+        final boolean sorted = isSortedLowerCase("INFRASTRUCTURE_TLDS");
+        assertTrue(sorted);
+    }
+
     @Test
     public void testInvalidDomains() {
         assertFalse(validator.isValid(".org"), "bare TLD .org shouldn't 
validate");
diff --git 
a/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java 
b/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java
index e1bf4fdc..7dc2ee6d 100644
--- 
a/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java
+++ 
b/src/test/java/org/apache/commons/validator/routines/EmailValidatorTest.java
@@ -471,18 +471,6 @@ public class EmailValidatorTest {
 
     }
 
-    @Test
-    public void testValidator278() {
-        assertFalse(validator.isValid("[email protected]")); // hostname 
starts with dash/hyphen
-        assertFalse(validator.isValid("[email protected]")); // hostname ends 
with dash/hyphen
-    }
-
-    @Test
-    public void testValidator315() {
-        assertFalse(validator.isValid("me@at&t.net"));
-        assertTrue(validator.isValid("[email protected]")); // Make sure TLD is not 
the cause of the failure
-    }
-
     @Test
     public void testValidator235() {
         final String version = SystemProperties.getJavaVersion();
@@ -498,6 +486,12 @@ public class EmailValidatorTest {
         assertFalse(validator.isValid("someone@www.\uFFFD.ch"), "www.\uFFFD.ch 
FFFD should fail");
     }
 
+    @Test
+    public void testValidator278() {
+        assertFalse(validator.isValid("[email protected]")); // hostname 
starts with dash/hyphen
+        assertFalse(validator.isValid("[email protected]")); // hostname ends 
with dash/hyphen
+    }
+
     @Test
     public void testValidator293() {
         assertTrue(validator.isValid("[email protected]"));
@@ -507,6 +501,12 @@ public class EmailValidatorTest {
         assertFalse(validator.isValid("abc@abc_def.com"));
     }
 
+    @Test
+    public void testValidator315() {
+        assertFalse(validator.isValid("me@at&t.net"));
+        assertTrue(validator.isValid("[email protected]")); // Make sure TLD is not 
the cause of the failure
+    }
+
     @Test
     public void testValidator359() {
         final EmailValidator val = EmailValidator.getInstance(false, true);

Reply via email to