This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git

commit f38422b29ec808f5d14cfc818ae568f77bd1eba9
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Jul 16 20:30:47 2026 -0400

    Sort members.
---
 .../validator/GenericTypeValidatorTest.java        | 30 +++++++++++-----------
 .../commons/validator/GenericValidatorTest.java    | 16 ++++++------
 .../validator/routines/UrlValidatorTest.java       | 26 +++++++++----------
 3 files changed, 36 insertions(+), 36 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java 
b/src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java
index 99329278..752ee3a6 100644
--- a/src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java
@@ -100,6 +100,21 @@ class GenericTypeValidatorTest extends AbstractCommonTest {
     protected void tearDown() {
     }
 
+    /**
+     * Tests that strict {@link GenericTypeValidator#formatDate(String, 
String, boolean)} rejects a value with trailing characters instead of parsing 
only its
+     * leading portion.
+     */
+    @Test
+    void testFormatDateStrict() {
+        assertNotNull(GenericTypeValidator.formatDate("11/11/1999", 
"MM/dd/yyyy", true));
+        // The trailing 'f' used to be dropped, leaving the year parsed as 199 
and the value reported as valid.
+        assertNull(GenericTypeValidator.formatDate("11/11/199f", "MM/dd/yyyy", 
true));
+        // An abbreviated field is still rejected in strict mode.
+        assertNull(GenericTypeValidator.formatDate("2/12/1999", "MM/dd/yyyy", 
true));
+        // Non-strict parsing stays lenient about the pattern length.
+        assertNotNull(GenericTypeValidator.formatDate("2/12/1999", 
"MM/dd/yyyy", false));
+    }
+
     /**
      * Tests the fr locale.
      */
@@ -133,21 +148,6 @@ class GenericTypeValidatorTest extends AbstractCommonTest {
         assertNull(GenericTypeValidator.formatLong("123x", Locale.US));
     }
 
-    /**
-     * Tests that strict {@link GenericTypeValidator#formatDate(String, 
String, boolean)} rejects a value with trailing characters instead of parsing 
only its
-     * leading portion.
-     */
-    @Test
-    void testFormatDateStrict() {
-        assertNotNull(GenericTypeValidator.formatDate("11/11/1999", 
"MM/dd/yyyy", true));
-        // The trailing 'f' used to be dropped, leaving the year parsed as 199 
and the value reported as valid.
-        assertNull(GenericTypeValidator.formatDate("11/11/199f", "MM/dd/yyyy", 
true));
-        // An abbreviated field is still rejected in strict mode.
-        assertNull(GenericTypeValidator.formatDate("2/12/1999", "MM/dd/yyyy", 
true));
-        // Non-strict parsing stays lenient about the pattern length.
-        assertNotNull(GenericTypeValidator.formatDate("2/12/1999", 
"MM/dd/yyyy", false));
-    }
-
     /**
      * Tests the byte validation.
      */
diff --git 
a/src/test/java/org/apache/commons/validator/GenericValidatorTest.java 
b/src/test/java/org/apache/commons/validator/GenericValidatorTest.java
index 36b81fe2..88a87310 100644
--- a/src/test/java/org/apache/commons/validator/GenericValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/GenericValidatorTest.java
@@ -26,6 +26,14 @@ import org.junit.jupiter.api.Test;
  */
 class GenericValidatorTest {
 
+    @Test
+    void testIsDate() {
+        assertTrue(GenericValidator.isDate("11/11/1999", "MM/dd/yyyy", true), 
"valid strict date");
+        // Strict validation used to accept a value with a trailing character 
by parsing only its leading portion.
+        assertFalse(GenericValidator.isDate("11/11/199f", "MM/dd/yyyy", true), 
"trailing character");
+        assertFalse(GenericValidator.isDate("2/12/1999", "MM/dd/yyyy", true), 
"abbreviated month");
+    }
+
     @Test
     void testMaxLength() {
 
@@ -48,14 +56,6 @@ class GenericValidatorTest {
         assertTrue(GenericValidator.maxLength("12345\n\r", 7, 2), "Max=7 
End=2");
     }
 
-    @Test
-    void testIsDate() {
-        assertTrue(GenericValidator.isDate("11/11/1999", "MM/dd/yyyy", true), 
"valid strict date");
-        // Strict validation used to accept a value with a trailing character 
by parsing only its leading portion.
-        assertFalse(GenericValidator.isDate("11/11/199f", "MM/dd/yyyy", true), 
"trailing character");
-        assertFalse(GenericValidator.isDate("2/12/1999", "MM/dd/yyyy", true), 
"abbreviated month");
-    }
-
     @Test
     void testMinLength() {
 
diff --git 
a/src/test/java/org/apache/commons/validator/routines/UrlValidatorTest.java 
b/src/test/java/org/apache/commons/validator/routines/UrlValidatorTest.java
index dcb05da7..4de098a8 100644
--- a/src/test/java/org/apache/commons/validator/routines/UrlValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/UrlValidatorTest.java
@@ -184,19 +184,6 @@ public class UrlValidatorTest {
         assertFalse(urlValidator.isValidAuthority("[::1]:65536"));
     }
 
-    @Test
-    void testIpv6Userinfo() {
-        final UrlValidator urlValidator = new UrlValidator();
-        // userinfo is allowed before a bracketed IPv6 host, not only before a 
hostname/IPv4 host
-        assertTrue(urlValidator.isValid("http://user@[::1]/";));
-        
assertTrue(urlValidator.isValid("http://user:pass@[2001:db8::1]:8080/index.html";));
-        assertTrue(urlValidator.isValidAuthority("user@[::1]"));
-        assertTrue(urlValidator.isValidAuthority("user:pass@[::1]:65535"));
-        // the host and port checks still apply through the userinfo path
-        
assertFalse(urlValidator.isValid("http://user@[::ffff:129.144.52.999]/";));
-        assertFalse(urlValidator.isValidAuthority("user@[::1]:65536"));
-    }
-
     @ParameterizedTest
     // @formatter:off
     @ValueSource(strings = {
@@ -240,6 +227,19 @@ public class UrlValidatorTest {
         assertTrue(urlValidator.isValidAuthority(host + ":80"));
     }
 
+    @Test
+    void testIpv6Userinfo() {
+        final UrlValidator urlValidator = new UrlValidator();
+        // userinfo is allowed before a bracketed IPv6 host, not only before a 
hostname/IPv4 host
+        assertTrue(urlValidator.isValid("http://user@[::1]/";));
+        
assertTrue(urlValidator.isValid("http://user:pass@[2001:db8::1]:8080/index.html";));
+        assertTrue(urlValidator.isValidAuthority("user@[::1]"));
+        assertTrue(urlValidator.isValidAuthority("user:pass@[::1]:65535"));
+        // the host and port checks still apply through the userinfo path
+        
assertFalse(urlValidator.isValid("http://user@[::ffff:129.144.52.999]/";));
+        assertFalse(urlValidator.isValidAuthority("user@[::1]:65536"));
+    }
+
     @Test
     void testIsValid() {
         testIsValid(testUrlParts, UrlValidator.ALLOW_ALL_SCHEMES);

Reply via email to