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


##########
src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java:
##########
@@ -171,6 +172,18 @@ void testType() throws ValidatorException {
 
     }
 
+    /**
+     * Tests that {@link GenericTypeValidator#formatLong(String, Locale)} 
rejects values just outside the long range instead of clamping them.
+     */
+    @Test
+    void testLongLocaleOverflow() {
+        assertEquals(Long.valueOf(Long.MAX_VALUE), 
GenericTypeValidator.formatLong("9223372036854775807", Locale.US));

Review Comment:
   Good point. Pushed a commit that drops the literals: the in-range cases now 
use Long.toString(Long.MAX_VALUE)/Long.toString(Long.MIN_VALUE), and the two 
overflow cases derive MAX+1 and MIN-1 via BigInteger so nothing is hand-typed.
   
   Confirmed the derived strings match the old literals exactly and the 
assertions still hold (bounds accepted, the two out-of-range values rejected).



-- 
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