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


The following commit(s) were added to refs/heads/master by this push:
     new 1b4e82c5 Preserve exact value in BigDecimal and BigInteger validate 
(#406).
1b4e82c5 is described below

commit 1b4e82c54e3e5a207a140299f7186ad88ae2f592
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jun 20 20:00:41 2026 +0000

    Preserve exact value in BigDecimal and BigInteger validate (#406).
    
    - Sort members.
    - Reduce vertical whitespace.
---
 src/changes/changes.xml                            |  1 +
 .../routines/AbstractNumberValidator.java          |  7 +++
 .../validator/routines/BigDecimalValidator.java    | 40 +++++++--------
 .../validator/routines/BigIntegerValidator.java    | 42 +++++++--------
 .../routines/BigDecimalValidatorTest.java          | 59 ++++++++--------------
 .../routines/BigIntegerValidatorTest.java          | 50 +++++++-----------
 6 files changed, 84 insertions(+), 115 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1262c5ba..b55e20e6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -88,6 +88,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action type="fix" dev="ggregory" due-to="Gary Gregory, 
sahvx655-wq">Compare exact values in BigInteger and BigDecimal Number range 
checks (#404).</action>
     <action type="fix" dev="ggregory" due-to="sahvx655-wq, Gary 
Gregory">Reject non-ASCII hex digits in isValidInet6Address (#403).</action>
     <action type="fix" dev="ggregory" due-to="sahvx655-wq, Gary 
Gregory">Accept IPv4-embedded IPv6 addresses in UrlValidator (#405).</action>
+    <action type="fix" dev="ggregory" due-to="sahvx655-wq, Gary 
Gregory">Preserve exact value in BigDecimal and BigInteger validate 
(#406)..</action>
     <!-- ADD -->
     <action type="add" dev="ggregory" due-to="Gary Gregory">Add and use 
CheckDigitException.CheckDigitException(String, Object...) (#389).</action>
     <action type="add" dev="ggregory" due-to="Gary Gregory">Add and use 
ValidatorException.ValidatorException(Throwable). Call sites that previously 
called new ValidatorException(Throwable#getMessage()) now preserve that 
exception (#390).</action>
diff --git 
a/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
 
b/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
index 5c32ce70..e2224b2e 100644
--- 
a/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
+++ 
b/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
@@ -51,6 +51,13 @@ public abstract class AbstractNumberValidator extends 
AbstractFormatValidator {
      */
     public static final int PERCENT_FORMAT = 2;
 
+    static Format setParseBigDecimal(final Format format) {
+        if (format instanceof DecimalFormat) {
+            ((DecimalFormat) format).setParseBigDecimal(true);
+        }
+        return format;
+    }
+
     /**
      * {@code true} if fractions are allowed or {@code false} if integers only.
      */
diff --git 
a/src/main/java/org/apache/commons/validator/routines/BigDecimalValidator.java 
b/src/main/java/org/apache/commons/validator/routines/BigDecimalValidator.java
index e61cedcd..82de51dd 100644
--- 
a/src/main/java/org/apache/commons/validator/routines/BigDecimalValidator.java
+++ 
b/src/main/java/org/apache/commons/validator/routines/BigDecimalValidator.java
@@ -151,6 +151,24 @@ public class BigDecimalValidator extends 
AbstractNumberValidator {
         return toBigDecimal(value1).compareTo(toBigDecimal(value2));
     }
 
+    /**
+     * Returns a {@code Format} that parses to a {@code BigDecimal} so the 
exact value of the input is preserved.
+     *
+     * <p>
+     * The superclass leaves {@link DecimalFormat} in its default mode, where 
{@code parse} yields a {@code Double} for a
+     * fractional value and so rounds an input carrying more significant 
digits than a {@code double} can hold. Enabling
+     * {@link DecimalFormat#setParseBigDecimal(boolean)} keeps the value as a 
{@code BigDecimal} through parsing.
+     * </p>
+     *
+     * @param pattern The pattern used to validate the value against or {@code 
null} to use the default for the {@link Locale}.
+     * @param locale  The locale to use for the format, system default if null.
+     * @return The {@code Format} to use.
+     */
+    @Override
+    protected Format getFormat(final String pattern, final Locale locale) {
+        return setParseBigDecimal(super.getFormat(pattern, locale));
+    }
+
     /**
      * Tests if the value is within a specified range.
      *
@@ -221,28 +239,6 @@ public class BigDecimalValidator extends 
AbstractNumberValidator {
         return isFinite(value) && isFinite(min) ? compareTo(value, min) >= 0 : 
value.doubleValue() >= min.doubleValue();
     }
 
-    /**
-     * Returns a {@code Format} that parses to a {@code BigDecimal} so the 
exact value of the input is preserved.
-     *
-     * <p>
-     * The superclass leaves {@link DecimalFormat} in its default mode, where 
{@code parse} yields a {@code Double} for a
-     * fractional value and so rounds an input carrying more significant 
digits than a {@code double} can hold. Enabling
-     * {@link DecimalFormat#setParseBigDecimal(boolean)} keeps the value as a 
{@code BigDecimal} through parsing.
-     * </p>
-     *
-     * @param pattern The pattern used to validate the value against or {@code 
null} to use the default for the {@link Locale}.
-     * @param locale  The locale to use for the format, system default if null.
-     * @return The {@code Format} to use.
-     */
-    @Override
-    protected Format getFormat(final String pattern, final Locale locale) {
-        final Format format = super.getFormat(pattern, locale);
-        if (format instanceof DecimalFormat) {
-            ((DecimalFormat) format).setParseBigDecimal(true);
-        }
-        return format;
-    }
-
     /**
      * Converts the parsed value to a {@code BigDecimal}.
      *
diff --git 
a/src/main/java/org/apache/commons/validator/routines/BigIntegerValidator.java 
b/src/main/java/org/apache/commons/validator/routines/BigIntegerValidator.java
index e6fa5ea8..c3b4f548 100644
--- 
a/src/main/java/org/apache/commons/validator/routines/BigIntegerValidator.java
+++ 
b/src/main/java/org/apache/commons/validator/routines/BigIntegerValidator.java
@@ -116,6 +116,25 @@ public class BigIntegerValidator extends 
AbstractNumberValidator {
         super(strict, formatType, false);
     }
 
+    /**
+     * Returns a {@code Format} that parses to a {@code BigDecimal} so the 
exact value of the input is preserved.
+     *
+     * <p>
+     * The superclass leaves {@link DecimalFormat} in its default mode, where 
{@code parse} yields a {@code Double} for a
+     * value outside the {@code long} range and so rounds an integer carrying 
more significant digits than a {@code double}
+     * can hold. Enabling {@link DecimalFormat#setParseBigDecimal(boolean)} 
keeps the full magnitude through parsing before
+     * it is converted to a {@code BigInteger}.
+     * </p>
+     *
+     * @param pattern The pattern used to validate the value against or {@code 
null} to use the default for the {@link Locale}.
+     * @param locale  The locale to use for the format, system default if null.
+     * @return The {@code Format} to use.
+     */
+    @Override
+    protected Format getFormat(final String pattern, final Locale locale) {
+        return setParseBigDecimal(super.getFormat(pattern, locale));
+    }
+
     /**
      * Tests if the value is within a specified range.
      *
@@ -184,29 +203,6 @@ public class BigIntegerValidator extends 
AbstractNumberValidator {
         return toBigInteger(value).compareTo(toBigInteger(min)) >= 0;
     }
 
-    /**
-     * Returns a {@code Format} that parses to a {@code BigDecimal} so the 
exact value of the input is preserved.
-     *
-     * <p>
-     * The superclass leaves {@link DecimalFormat} in its default mode, where 
{@code parse} yields a {@code Double} for a
-     * value outside the {@code long} range and so rounds an integer carrying 
more significant digits than a {@code double}
-     * can hold. Enabling {@link DecimalFormat#setParseBigDecimal(boolean)} 
keeps the full magnitude through parsing before
-     * it is converted to a {@code BigInteger}.
-     * </p>
-     *
-     * @param pattern The pattern used to validate the value against or {@code 
null} to use the default for the {@link Locale}.
-     * @param locale  The locale to use for the format, system default if null.
-     * @return The {@code Format} to use.
-     */
-    @Override
-    protected Format getFormat(final String pattern, final Locale locale) {
-        final Format format = super.getFormat(pattern, locale);
-        if (format instanceof DecimalFormat) {
-            ((DecimalFormat) format).setParseBigDecimal(true);
-        }
-        return format;
-    }
-
     /**
      * Converts the parsed value to a {@code BigInteger}.
      *
diff --git 
a/src/test/java/org/apache/commons/validator/routines/BigDecimalValidatorTest.java
 
b/src/test/java/org/apache/commons/validator/routines/BigDecimalValidatorTest.java
index 4d07ad05..5ee9336d 100644
--- 
a/src/test/java/org/apache/commons/validator/routines/BigDecimalValidatorTest.java
+++ 
b/src/test/java/org/apache/commons/validator/routines/BigDecimalValidatorTest.java
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.validator.routines;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -36,21 +37,16 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
     protected void setUp() {
         validator = new BigDecimalValidator(false);
         strictValidator = new BigDecimalValidator();
-
         testPattern = "#,###.###";
-
         // testValidateMinMax()
         max = null;
         maxPlusOne = null;
         min = null;
         minMinusOne = null;
-
         // testInvalidStrict()
         invalidStrict = new String[] { null, "", "X", "X12", "12X", "1X2", 
"1.234X" };
-
         // testInvalidNotStrict()
         invalid = new String[] { null, "", "X", "X12" };
-
         // testValid()
         testNumber = new BigDecimal("1234.5");
         final Number testNumber2 = new BigDecimal(".1");
@@ -60,22 +56,18 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
         validStrictCompare = new Number[] { testZero, testNumber, testNumber, 
testNumber2, testNumber3 };
         valid = new String[] { "0", "1234.5", "1,234.5", "1,234.5", "1234.5X" 
};
         validCompare = new Number[] { testZero, testNumber, testNumber, 
testNumber, testNumber };
-
         testStringUS = "1,234.5";
         testStringDE = "1.234,5";
-
         // Localized Pattern test
         localeValue = testStringDE;
         localePattern = "#.###,#";
         testLocale = Locale.GERMANY;
         localeExpected = testNumber;
-
     }
 
     /**
      * Tests isInRange(), minValue(), and maxValue() with BigDecimal values 
whose magnitude exceeds Double.MAX_VALUE or whose positive magnitude is below
      * Double.MIN_VALUE (the smallest positive non-zero double).
-     *
      * <p>
      * Because the implementation converts the BigDecimal to a {@code double} 
via {@link BigDecimal#doubleValue()}, values beyond {@code ±Double.MAX_VALUE}
      * overflow to {@code ±Double.POSITIVE_INFINITY} / {@code 
Double.NEGATIVE_INFINITY}, and tiny positive values below {@code 
Double.MIN_VALUE} underflow to
@@ -118,11 +110,10 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
 
     /**
      * Tests isInRange(), minValue(), and maxValue() with BigDecimal values 
that lie within Double range but cannot be represented exactly as a {@code 
double}.
-     *
      * <p>
      * 2<sup>53</sup>&nbsp;+&nbsp;1 is the smallest positive integer a {@code 
double} cannot hold, so {@link BigDecimal#doubleValue()} rounds it back to
-     * 2<sup>53</sup>. Comparing through {@code doubleValue()} therefore 
reported it as equal to (and not above) 2<sup>53</sup>, accepting a value that 
exceeds the
-     * supplied maximum. The comparison is done against the exact BigDecimal 
so the rounding no longer leaks into the result.
+     * 2<sup>53</sup>. Comparing through {@code doubleValue()} therefore 
reported it as equal to (and not above) 2<sup>53</sup>, accepting a value that 
exceeds
+     * the supplied maximum. The comparison is done against the exact 
BigDecimal so the rounding no longer leaks into the result.
      * </p>
      */
     @Test
@@ -143,9 +134,7 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
     }
 
     /**
-     * Tests isInRange(), minValue(), and maxValue() when a bound is {@link 
Double#NaN}, {@link Double#POSITIVE_INFINITY} or
-     * {@link Double#NEGATIVE_INFINITY}.
-     *
+     * Tests isInRange(), minValue(), and maxValue() when a bound is {@link 
Double#NaN}, {@link Double#POSITIVE_INFINITY} or {@link 
Double#NEGATIVE_INFINITY}.
      * <p>
      * {@link BigDecimal#valueOf(double)} rejects non-finite doubles, so these 
bounds keep the {@code doubleValue()} comparison path. A {@code NaN} bound can
      * never be satisfied because every comparison with {@code NaN} is false. 
{@code POSITIVE_INFINITY} as a maximum (or {@code NEGATIVE_INFINITY} as a 
minimum)
@@ -166,8 +155,7 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
         // POSITIVE_INFINITY maximum / NEGATIVE_INFINITY minimum: open bound, 
any finite value qualifies
         assertTrue(validator.maxValue(value, Double.POSITIVE_INFINITY), 
"maxValue: a finite value is <= +Infinity");
         assertTrue(validator.minValue(value, Double.NEGATIVE_INFINITY), 
"minValue: a finite value is >= -Infinity");
-        assertTrue(validator.isInRange(value, Double.NEGATIVE_INFINITY, 
Double.POSITIVE_INFINITY),
-                "isInRange: a finite value is in [-Infinity, +Infinity]");
+        assertTrue(validator.isInRange(value, Double.NEGATIVE_INFINITY, 
Double.POSITIVE_INFINITY), "isInRange: a finite value is in [-Infinity, 
+Infinity]");
         // NEGATIVE_INFINITY maximum / POSITIVE_INFINITY minimum: no finite 
value qualifies
         assertFalse(validator.maxValue(value, Double.NEGATIVE_INFINITY), 
"maxValue: a finite value is not <= -Infinity");
         assertFalse(validator.minValue(value, Double.POSITIVE_INFINITY), 
"minValue: a finite value is not >= +Infinity");
@@ -205,21 +193,6 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
         assertFalse(validator.maxValue(number21, max), "maxValue(A) > max");
     }
 
-    /**
-     * A value carrying more significant digits than a {@code double} can hold 
must be converted exactly. Parsing through a
-     * {@code double} rounds at about 17 digits, so the result has to come 
straight from the {@code BigDecimal} parse.
-     */
-    @Test
-    void testValueBeyondDoublePrecision() {
-        final BigDecimalValidator validator = 
BigDecimalValidator.getInstance();
-        final BigDecimal expected = new BigDecimal("0.12345678901234567890");
-        assertEquals(expected, validator.validate(expected.toPlainString(), 
Locale.US));
-
-        // 2^53 + 1 has 16 digits but is the smallest integer a double cannot 
represent
-        final BigDecimal unrepresentable = 
BigDecimal.valueOf(2).pow(53).add(BigDecimal.ONE);
-        assertEquals(unrepresentable, 
validator.validate(unrepresentable.toPlainString(), Locale.US));
-    }
-
     /**
      * Test BigDecimalValidator validate Methods
      */
@@ -237,17 +210,14 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
         assertEquals(expected, 
BigDecimalValidator.getInstance().validate(localeVal, locale), "validate(A) 
locale ");
         assertEquals(expected, 
BigDecimalValidator.getInstance().validate(patternVal, pattern), "validate(A) 
pattern");
         assertEquals(expected, 
BigDecimalValidator.getInstance().validate(germanPatternVal, pattern, 
Locale.GERMAN), "validate(A) both");
-
         assertTrue(BigDecimalValidator.getInstance().isValid(defaultVal), 
"isValid(A) default");
         assertTrue(BigDecimalValidator.getInstance().isValid(localeVal, 
locale), "isValid(A) locale ");
         assertTrue(BigDecimalValidator.getInstance().isValid(patternVal, 
pattern), "isValid(A) pattern");
         assertTrue(BigDecimalValidator.getInstance().isValid(germanPatternVal, 
pattern, Locale.GERMAN), "isValid(A) both");
-
         assertNull(BigDecimalValidator.getInstance().validate(xxxx), 
"validate(B) default");
         assertNull(BigDecimalValidator.getInstance().validate(xxxx, locale), 
"validate(B) locale");
         assertNull(BigDecimalValidator.getInstance().validate(xxxx, pattern), 
"validate(B) pattern");
         assertNull(BigDecimalValidator.getInstance().validate(patternVal, 
pattern, Locale.GERMAN), "validate(B) both");
-
         assertFalse(BigDecimalValidator.getInstance().isValid(xxxx), 
"isValid(B) default");
         assertFalse(BigDecimalValidator.getInstance().isValid(xxxx, locale), 
"isValid(B) locale");
         assertFalse(BigDecimalValidator.getInstance().isValid(xxxx, pattern), 
"isValid(B) pattern");
@@ -255,9 +225,8 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
     }
 
     /**
-     * The {@link Number} overloads inherited from the superclass must compare 
the exact value against a
-     * {@code BigDecimal} bound, not values narrowed to a double, so a 
difference smaller than double precision
-     * is not lost.
+     * The {@link Number} overloads inherited from the superclass must compare 
the exact value against a {@code BigDecimal} bound, not values narrowed to a
+     * double, so a difference smaller than double precision is not lost.
      */
     @Test
     void testNumberRangeBeyondDoublePrecision() {
@@ -271,4 +240,18 @@ class BigDecimalValidatorTest extends 
AbstractNumberValidatorTest {
         assertTrue(validator.minValue(value, bound));
         assertFalse(validator.isInRange(value, 
twoPow53.subtract(BigDecimal.ONE), bound));
     }
+
+    /**
+     * A value carrying more significant digits than a {@code double} can hold 
must be converted exactly. Parsing through a {@code double} rounds at about 17
+     * digits, so the result has to come straight from the {@code BigDecimal} 
parse.
+     */
+    @Test
+    void testValueBeyondDoublePrecision() {
+        final BigDecimalValidator validator = 
BigDecimalValidator.getInstance();
+        final BigDecimal expected = new BigDecimal("0.12345678901234567890");
+        assertEquals(expected, validator.validate(expected.toPlainString(), 
Locale.US));
+        // 2^53 + 1 has 16 digits but is the smallest integer a double cannot 
represent
+        final BigDecimal unrepresentable = 
BigDecimal.valueOf(2).pow(53).add(BigDecimal.ONE);
+        assertEquals(unrepresentable, 
validator.validate(unrepresentable.toPlainString(), Locale.US));
+    }
 }
diff --git 
a/src/test/java/org/apache/commons/validator/routines/BigIntegerValidatorTest.java
 
b/src/test/java/org/apache/commons/validator/routines/BigIntegerValidatorTest.java
index 854339b2..79e27edb 100644
--- 
a/src/test/java/org/apache/commons/validator/routines/BigIntegerValidatorTest.java
+++ 
b/src/test/java/org/apache/commons/validator/routines/BigIntegerValidatorTest.java
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.validator.routines;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -36,21 +37,16 @@ class BigIntegerValidatorTest extends 
AbstractNumberValidatorTest {
     protected void setUp() {
         validator = new BigIntegerValidator(false, 0);
         strictValidator = new BigIntegerValidator();
-
         testPattern = "#,###";
-
         // testValidateMinMax()
         max = null;
         maxPlusOne = null;
         min = null;
         minMinusOne = null;
-
         // testInvalidStrict()
         invalidStrict = new String[] { null, "", "X", "X12", "12X", "1X2", 
"1.2" };
-
         // testInvalidNotStrict()
         invalid = new String[] { null, "", "X", "X12" };
-
         // testValid()
         testNumber = new BigInteger("1234");
         testZero = new BigInteger("0");
@@ -58,16 +54,13 @@ class BigIntegerValidatorTest extends 
AbstractNumberValidatorTest {
         validStrictCompare = new Number[] { testZero, testNumber, testNumber };
         valid = new String[] { "0", "1234", "1,234", "1,234.5", "1234X" };
         validCompare = new Number[] { testZero, testNumber, testNumber, 
testNumber, testNumber };
-
         testStringUS = "1,234";
         testStringDE = "1.234";
-
         // Localized Pattern test
         localeValue = testStringDE;
         localePattern = "#.###";
         testLocale = Locale.GERMANY;
         localeExpected = testNumber;
-
     }
 
     /**
@@ -92,21 +85,6 @@ class BigIntegerValidatorTest extends 
AbstractNumberValidatorTest {
         assertEquals(BigDecimalValidator.getInstance().validate(aboveLongStr, 
"#").toBigInteger(), resultAboveLong);
     }
 
-    /**
-     * A value carrying more significant digits than a {@code double} can hold 
must be converted exactly. Scaling
-     * {@link Long#MAX_VALUE} up pushes past the roughly 17 significant digits 
a double can represent, so a result routed
-     * through a double would be rounded rather than preserved.
-     */
-    @Test
-    void testBigIntegerExactBeyondDoublePrecision() {
-        final BigInteger exact = 
BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN).add(BigInteger.valueOf(7));
-        final String exactStr = exact.toString();
-        final BigIntegerValidator instance = BigIntegerValidator.getInstance();
-        assertEquals(exact, instance.validate(exactStr, "#"));
-        // BigInteger and BigDecimal validators must agree on the exact value
-        assertEquals(BigDecimalValidator.getInstance().validate(exactStr, 
"#").toBigInteger(), instance.validate(exactStr, "#"));
-    }
-
     /**
      * Test a value larger than {@link Long#MAX_VALUE} keeps its magnitude 
instead of being clamped to {@link Long#MAX_VALUE}.
      */
@@ -129,6 +107,20 @@ class BigIntegerValidatorTest extends 
AbstractNumberValidatorTest {
         assertEquals(BigDecimalValidator.getInstance().validate(belowLongStr, 
"#").toBigInteger(), resultBelowLong);
     }
 
+    /**
+     * A value carrying more significant digits than a {@code double} can hold 
must be converted exactly. Scaling {@link Long#MAX_VALUE} up pushes past the
+     * roughly 17 significant digits a double can represent, so a result 
routed through a double would be rounded rather than preserved.
+     */
+    @Test
+    void testBigIntegerExactBeyondDoublePrecision() {
+        final BigInteger exact = 
BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN).add(BigInteger.valueOf(7));
+        final String exactStr = exact.toString();
+        final BigIntegerValidator instance = BigIntegerValidator.getInstance();
+        assertEquals(exact, instance.validate(exactStr, "#"));
+        // BigInteger and BigDecimal validators must agree on the exact value
+        assertEquals(BigDecimalValidator.getInstance().validate(exactStr, 
"#").toBigInteger(), instance.validate(exactStr, "#"));
+    }
+
     /**
      * Test BigInteger Range/Min/Max
      */
@@ -141,19 +133,16 @@ class BigIntegerValidatorTest extends 
AbstractNumberValidatorTest {
         final BigInteger number19 = validator.validate("19", "#");
         final BigInteger number20 = validator.validate("20", "#");
         final BigInteger number21 = validator.validate("21", "#");
-
         // Test isInRange()
         assertFalse(validator.isInRange(number9, 10, 20), "isInRange() < min");
         assertTrue(validator.isInRange(number10, 10, 20), "isInRange() = min");
         assertTrue(validator.isInRange(number11, 10, 20), "isInRange() in 
range");
         assertTrue(validator.isInRange(number20, 10, 20), "isInRange() = max");
         assertFalse(validator.isInRange(number21, 10, 20), "isInRange() > 
max");
-
         // Test minValue()
         assertFalse(validator.minValue(number9, 10), "minValue() < min");
         assertTrue(validator.minValue(number10, 10), "minValue() = min");
         assertTrue(validator.minValue(number11, 10), "minValue() > min");
-
         // Test minValue()
         assertTrue(validator.maxValue(number19, 20), "maxValue() < max");
         assertTrue(validator.maxValue(number20, 20), "maxValue() = max");
@@ -177,17 +166,14 @@ class BigIntegerValidatorTest extends 
AbstractNumberValidatorTest {
         assertEquals(expected, 
BigIntegerValidator.getInstance().validate(localeVal, locale), "validate(A) 
locale ");
         assertEquals(expected, 
BigIntegerValidator.getInstance().validate(patternVal, pattern), "validate(A) 
pattern");
         assertEquals(expected, 
BigIntegerValidator.getInstance().validate(germanPatternVal, pattern, 
Locale.GERMAN), "validate(A) both");
-
         assertTrue(BigIntegerValidator.getInstance().isValid(defaultVal), 
"isValid(A) default");
         assertTrue(BigIntegerValidator.getInstance().isValid(localeVal, 
locale), "isValid(A) locale ");
         assertTrue(BigIntegerValidator.getInstance().isValid(patternVal, 
pattern), "isValid(A) pattern");
         assertTrue(BigIntegerValidator.getInstance().isValid(germanPatternVal, 
pattern, Locale.GERMAN), "isValid(A) both");
-
         assertNull(BigIntegerValidator.getInstance().validate(xxxx), 
"validate(B) default");
         assertNull(BigIntegerValidator.getInstance().validate(xxxx, locale), 
"validate(B) locale ");
         assertNull(BigIntegerValidator.getInstance().validate(xxxx, pattern), 
"validate(B) pattern");
         assertNull(BigIntegerValidator.getInstance().validate(patternVal, 
pattern, Locale.GERMAN), "validate(B) both");
-
         assertFalse(BigIntegerValidator.getInstance().isValid(xxxx), 
"isValid(B) default");
         assertFalse(BigIntegerValidator.getInstance().isValid(xxxx, locale), 
"isValid(B) locale ");
         assertFalse(BigIntegerValidator.getInstance().isValid(xxxx, pattern), 
"isValid(B) pattern");
@@ -211,12 +197,12 @@ class BigIntegerValidatorTest extends 
AbstractNumberValidatorTest {
     }
 
     /**
-     * The {@link Number} overloads inherited from the superclass must compare 
the exact value, not a value
-     * narrowed to a long, for BigIntegers outside the long range.
+     * The {@link Number} overloads inherited from the superclass must compare 
the exact value, not a value narrowed to a long, for BigIntegers outside the 
long
+     * range.
      */
     @Test
     void testNumberRangeOutsideLongRange() {
-        final BigIntegerValidator instance = BigIntegerValidator.getInstance();
+        final AbstractNumberValidator instance = 
BigIntegerValidator.getInstance();
         final Number min = BigInteger.valueOf(5);
         final Number max = BigInteger.valueOf(100);
         // 2^63 narrows to Long.MIN_VALUE, which the long-based comparison 
wrongly reports as below the range

Reply via email to