sahvx655-wq commented on code in PR #399:
URL: https://github.com/apache/commons-validator/pull/399#discussion_r3418305414


##########
src/test/java/org/apache/commons/validator/routines/ISINValidatorTest.java:
##########
@@ -110,4 +111,15 @@ void testIsValidTrue() {
         }
     }
 
+    @Test
+    void testValidWithSurroundingWhitespaceCountryCode() {
+        // The underlying CodeValidator trims the input, so the country code 
must be
+        // derived from the trimmed code. Otherwise a valid ISIN with leading 
whitespace
+        // is accepted without the country check but rejected with it.
+        final String leading = " US0378331005";

Review Comment:
   Trailing whitespace is handled the same way. CodeValidator.validate trims 
both ends before matching, and since the fix now reads the country code from 
the validated/trimmed value rather than the raw argument, the substring(0, 2) 
lookup sees "US" regardless of where the whitespace sits.
   
   I have extended the regression test to loop over leading, trailing and 
surrounding whitespace so all three paths are covered. Full ISINValidatorTest 
still passes (Tests run: 5, Failures: 0).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to