@@ -40,6 +40,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
4040import org .junit .jupiter .params .ParameterizedTest ;
4141import org .junit .jupiter .params .provider .Arguments ;
4242import org .junit .jupiter .params .provider .MethodSource ;
43+ import org .junit .jupiter .params .provider .ValueSource ;
4344
4445/**
4546 * Test case for the HelpFormatter class.
@@ -154,19 +155,21 @@ void testDefaultArgName() {
154155 assertEquals ("usage: app -f <argument>" + EOL , out .toString ());
155156 }
156157
157- @ Test
158- public void testDeprecatedFindWrapPosZeroWidth () {
159- final int pos = new HelpFormatter ().findWrapPos ("Hello World" , 0 , 0 );
160- assertEquals (0 , pos );
158+ @ ParameterizedTest
159+ @ ValueSource (ints = { -100 , -1 , 0 })
160+ public void testDeprecatedFindWrapPosZeroWidth (final int width ) {
161+ final int pos = new HelpFormatter ().findWrapPos ("Hello World" , width , 0 );
162+ assertEquals (width , pos );
161163 }
162164
163- @ Test
164- public void testDeprecatedPrintOptionsZeroWidth () {
165+ @ ParameterizedTest
166+ @ ValueSource (ints = { -100 , -1 , 0 })
167+ public void testDeprecatedPrintOptionsZeroWidth (final int width ) {
165168 final Options options = new Options ();
166169 options .addOption ("h" , "help" , false , "Show help" );
167170 final StringWriter out = new StringWriter ();
168171 final PrintWriter pw = new PrintWriter (out );
169- new HelpFormatter ().printOptions (pw , 0 , options , 1 , 3 );
172+ new HelpFormatter ().printOptions (pw , width , options , 1 , 3 );
170173 final String result = out .toString ();
171174 assertNotNull (result );
172175 }
0 commit comments