From 8a54256f86f74c686d69f0e7196a39aa924412a2 Mon Sep 17 00:00:00 2001 From: Lora-Scott Date: Sun, 5 Jul 2026 17:41:27 +0800 Subject: [PATCH] test: add parsing boundary unit tests for ComplexFormat --- .../math4/legacy/util/ComplexFormatTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatTest.java index 9af9741218..9452aa3d3d 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatTest.java @@ -30,4 +30,22 @@ protected char getDecimalCharacter() { protected Locale getLocale() { return Locale.US; } + @Test + public void testParseBoundaryConditions() { + ComplexFormat format = ComplexFormat.getInstance(); + + // Test parsing empty string boundary + try { + format.parse(""); + } catch (Exception ex) { + // Expected exception for empty input + } + + // Test parsing garbage/invalid string boundary + try { + format.parse("invalid_complex_string"); + } catch (Exception ex) { + // Expected exception for invalid input + } + } }