@@ -151,18 +151,6 @@ public void testGetParsedOptionValueWithChar() throws Exception {
151151 assertEquals ("foo" , cmd .getParsedOptionValue ('f' ));
152152 }
153153
154- @ Test
155- public void testGetParsedOptionValueWithNullSupplier () throws Exception {
156- final Options options = new Options ();
157- options .addOption (Option .builder ("i" ).hasArg ().type (Number .class ).build ());
158-
159- final CommandLineParser parser = new DefaultParser ();
160- final CommandLine cmd = parser .parse (options , new String [0 ]);
161- final Supplier <Number > supplier = null ;
162-
163- assertNull (cmd .getParsedOptionValue ('i' , supplier ));
164- }
165-
166154 @ Test
167155 public void testGetParsedOptionValueWithOption () throws Exception {
168156 final Options options = new Options ();
@@ -188,14 +176,27 @@ public void testGetParsedOptionValueUsingDefault() throws Exception {
188176
189177 final CommandLineParser parser = new DefaultParser ();
190178 final CommandLine cmd = parser .parse (options , new String [] {"-i" , "123" });
179+ final Supplier <String > nullSupplier = null ;
191180
192181 assertEquals (123 , ((Number ) cmd .getParsedOptionValue (optI )).intValue ());
193182 assertEquals ("foo" , cmd .getParsedOptionValue (optF , "foo" ));
194183 assertEquals ("foo" , cmd .getParsedOptionValue (optF , () -> "foo" ));
184+ assertNull (cmd .getParsedOptionValue (optF , null ));
185+ assertNull (cmd .getParsedOptionValue (optF , nullSupplier ));
186+ assertNull (cmd .getParsedOptionValue (optF , () -> null ));
187+
195188 assertEquals ("foo" , cmd .getParsedOptionValue ("f" , "foo" ));
196189 assertEquals ("foo" , cmd .getParsedOptionValue ("f" , () -> "foo" ));
190+ assertNull (cmd .getParsedOptionValue ("f" , null ));
191+ assertNull (cmd .getParsedOptionValue ("f" , nullSupplier ));
192+ assertNull (cmd .getParsedOptionValue ("f" , () -> null ));
193+
197194 assertEquals ("foo" , cmd .getParsedOptionValue ('f' , "foo" ));
198195 assertEquals ("foo" , cmd .getParsedOptionValue ('f' , () -> "foo" ));
196+ assertNull (cmd .getParsedOptionValue ('f' , null ));
197+ assertNull (cmd .getParsedOptionValue ('f' , nullSupplier ));
198+ assertNull (cmd .getParsedOptionValue ('f' , () -> null ));
199+
199200 }
200201
201202 @ Test
0 commit comments