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 9af974121..9452aa3d3 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 + } + } }