@@ -147,6 +147,19 @@ void testPrintHelp() throws IOException {
147147 assertEquals (0 , sb .length (), "Should not write to output" );
148148 }
149149
150+ /**
151+ * Tests example from the mailing list that caused an infinite loop.
152+ *
153+ * @see <a href="https://issues.apache.org/jira/browse/CLI-351">[CLI-351] Multiple traililng BREAK_CHAR_SET characters cause infinite loop in
154+ * HelpFormatter</a>
155+ */
156+ @ Test
157+ void testPrintHelpHeader () throws IOException {
158+ HelpFormatter .builder ().get ().printHelp ("CL syntax" , "Header" , Collections .emptyList (), "Footer" , true );
159+ HelpFormatter .builder ().get ().printHelp ("CL syntax" , "Header\n \n " , // This makes printHelp enter into an infinite loop
160+ Collections .emptyList (), "Footer" , true );
161+ }
162+
150163 @ Test
151164 void testPrintHelpWithDefaults () throws IOException {
152165 final StringBuilder sb = new StringBuilder ();
@@ -167,19 +180,6 @@ void testPrintHelpWithDefaults() throws IOException {
167180 assertEquals (expected , actual );
168181 }
169182
170- /**
171- * Tests example from the mailing list that caused an infinite loop.
172- *
173- * @see <a href="https://issues.apache.org/jira/browse/CLI-351">[CLI-351] Multiple traililng BREAK_CHAR_SET characters cause infinite loop in
174- * HelpFormatter</a>
175- */
176- @ Test
177- void testPrintHelpHeader () throws IOException {
178- HelpFormatter .builder ().get ().printHelp ("CL syntax" , "Header" , Collections .emptyList (), "Footer" , true );
179- HelpFormatter .builder ().get ().printHelp ("CL syntax" , "Header\n \n " , // This makes printHelp enter into an infinite loop
180- Collections .emptyList (), "Footer" , true );
181- }
182-
183183 @ Test
184184 void testPrintHelpWithIterableOptions () throws IOException {
185185 final StringBuilder sb = new StringBuilder ();
0 commit comments