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 35376e48374e65382f37a1c4b7d9d169908d2e70 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jun 13 12:03:31 2026 +0000 Refactor NumberUtilsTest.testCreateIntegerFailure() test using @ParameterizedTest --- .../org/apache/commons/lang3/math/NumberUtilsTest.java | 14 +++++++++----- 1 file changed, 9 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 234ef9a0f..8a1284230 100644 --- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java @@ -556,15 +556,19 @@ protected void testCreateFloatFailure(final String str) { void testCreateInteger() { assertEquals(Integer.valueOf("12345"), NumberUtils.createInteger("12345"), "createInteger(String) failed"); assertNull(NumberUtils.createInteger(null), "createInteger(null) failed"); - testCreateIntegerFailure(""); - testCreateIntegerFailure(" "); - testCreateIntegerFailure("\b\t\n\f\r"); - // Funky whitespaces - testCreateIntegerFailure("\u00A0\uFEFF\u000B\u000C\u001C\u001D\u001E\u001F"); // LANG-1645 assertEquals(Integer.decode("+0xF"), NumberUtils.createInteger("+0xF")); } + @ParameterizedTest + @ValueSource(strings = { + // @formatter:off + "", + " ", + "\b\t\n\f\r", + // Funky whitespaces + "\u00A0\uFEFF\u000B\u000C\u001C\u001D\u001E\u001F" }) + // @formatter:on protected void testCreateIntegerFailure(final String str) { assertThrows(NumberFormatException.class, () -> NumberUtils.createInteger(str), "createInteger(\"" + str + "\") should have failed."); }
