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 7ce93bc4a7f6a9b482dbad814c1badd13aa09eea
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jun 13 12:06:52 2026 +0000

    Refactor NumberUtilsTest.testCreateLongFailure() test using
    @ParameterizedTest
---
 .../org/apache/commons/lang3/math/NumberUtilsTest.java  | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 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 5104d4bf9..840b68b72 100644
--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
@@ -579,17 +579,22 @@ void testCreateIntegerFailure(final String str) {
     void testCreateLong() {
         assertEquals(Long.valueOf("12345"), NumberUtils.createLong("12345"), 
"createLong(String) failed");
         assertNull(NumberUtils.createLong(null), "createLong(null) failed");
-        testCreateLongFailure("");
-        testCreateLongFailure(" ");
-        testCreateLongFailure("\b\t\n\f\r");
-        // Funky whitespaces
-        
testCreateLongFailure("\u00A0\uFEFF\u000B\u000C\u001C\u001D\u001E\u001F");
         // LANG-1645
         assertEquals(Long.decode("+0xFFFFFFFF"), 
NumberUtils.createLong("+0xFFFFFFFF"));
     }
 
-    protected void testCreateLongFailure(final String str) {
+    @ParameterizedTest
+    @ValueSource(strings = {
+            // @formatter:off
+            "",
+            " ",
+            "\b\t\n\f\r",
+            // Funky whitespaces
+            "\u00A0\uFEFF\u000B\u000C\u001C\u001D\u001E\u001F" })
+            // @formatter:on
+    void testCreateLongFailure(final String str) {
         assertThrows(NumberFormatException.class, () -> 
NumberUtils.createLong(str), "createLong(\"" + str + "\") should have failed.");
+        assertThrows(NumberFormatException.class, () -> Long.valueOf(str));
     }
 
     @Test

Reply via email to