@@ -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 public void testPrintHelpWithIterableOptions () throws IOException {
152165 final StringBuilder sb = new StringBuilder ();
@@ -226,19 +239,6 @@ public void testPrintHelpWithIterableOptions() throws IOException {
226239 assertEquals (0 , sb .length (), "Should not write to output" );
227240 }
228241
229- /**
230- * Tests example from the mailing list that caused an infinite loop.
231- *
232- * @see <a href="https://issues.apache.org/jira/browse/CLI-351">[CLI-351] Multiple traililng BREAK_CHAR_SET characters cause infinite loop in
233- * HelpFormatter</a>
234- */
235- @ Test
236- void testPrintHelpHeader () throws IOException {
237- HelpFormatter .builder ().get ().printHelp ("CL syntax" , "Header" , Collections .emptyList (), "Footer" , true );
238- HelpFormatter .builder ().get ().printHelp ("CL syntax" , "Header\n \n " , // This makes printHelp enter into an infinite loop
239- Collections .emptyList (), "Footer" , true );
240- }
241-
242242 @ Test
243243 void testPrintHelpXML () throws IOException {
244244 final StringBuilder sb = new StringBuilder ();
0 commit comments