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-lang.git

commit 7cd272ed863e2220be20829f84efd06ef8bf4211
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jun 13 12:01:47 2026 +0000

    Refactor NumberUtilsTest.testCreateDouble() test using
    @ParameterizedTest
---
 .../org/apache/commons/lang3/math/NumberUtilsTest.java    | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
index c587dd32b..39eb71e8c 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -517,15 +517,20 @@ void testCreateDouble() {
         final String string2 = "0.100000001490116121";
         assertEquals(Double.valueOf(string2), 
NumberUtils.createDouble(string2));
         assertNull(NumberUtils.createDouble(null), "createDouble(null) 
failed");
-        testCreateDoubleFailure("");
-        testCreateDoubleFailure(" ");
-        testCreateDoubleFailure("\b\t\n\f\r");
-        // Funky whitespaces
-        
testCreateDoubleFailure("\u00A0\uFEFF\u000B\u000C\u001C\u001D\u001E\u001F");
     }
 
+    @ParameterizedTest
+    @ValueSource(strings = {
+            // @formatter:off
+            "",
+            " ",
+            "\b\t\n\f\r",
+            // Funky whitespaces
+            "\u00A0\uFEFF\u000B\u000C\u001C\u001D\u001E\u001F" })
+            // @formatter:on
     protected void testCreateDoubleFailure(final String str) {
         assertThrows(NumberFormatException.class, () -> 
NumberUtils.createDouble(str), "createDouble(\"" + str + "\") should have 
failed.");
+        assertThrows(NumberFormatException.class, () -> Double.valueOf(str));
     }
 
     @Test

Reply via email to