@@ -14,6 +14,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
1414 See the License for the specific language governing permissions and
1515 limitations under the License.
1616 */
17+
1718package org .apache .commons .cli ;
1819
1920import static org .junit .jupiter .api .Assertions .assertEquals ;
@@ -26,7 +27,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2627import java .util .ArrayList ;
2728import java .util .Date ;
2829import java .util .List ;
29- import java .util .Locale ;
3030import java .util .stream .Stream ;
3131
3232import org .junit .jupiter .api .Test ;
@@ -42,13 +42,13 @@ public class ConverterTests {
4242
4343 // A class without a default constructor.
4444 public class AClassWithoutADefaultConstructor {
45+
4546 public AClassWithoutADefaultConstructor (final int i ) {
4647 }
4748 }
4849
4950 private static Stream <Arguments > numberTestParameters () {
5051 final List <Arguments > lst = new ArrayList <>();
51-
5252 lst .add (Arguments .of ("123" , Long .valueOf ("123" )));
5353 lst .add (Arguments .of ("12.3" , Double .valueOf ("12.3" )));
5454 lst .add (Arguments .of ("-123" , Long .valueOf ("-123" )));
@@ -58,38 +58,30 @@ private static Stream<Arguments> numberTestParameters() {
5858 lst .add (Arguments .of ("0x5F" , null ));
5959 lst .add (Arguments .of ("2,3" , null ));
6060 lst .add (Arguments .of ("1.2.3" , null ));
61-
6261 return lst .stream ();
6362 }
6463
6564 @ Test
6665 void testClass () throws Exception {
67-
6866 assertNotNull (Converter .CLASS .apply (this .getClass ().getName ()), this .getClass ().getName ());
6967 assertNotNull (Converter .CLASS .apply (this .getClass ().getCanonicalName ()), this .getClass ().getCanonicalName ());
70- assertThrows (ClassNotFoundException .class , () -> Converter .CLASS .apply (this .getClass ().getSimpleName ()),
71- this .getClass ().getSimpleName ());
68+ assertThrows (ClassNotFoundException .class , () -> Converter .CLASS .apply (this .getClass ().getSimpleName ()), this .getClass ().getSimpleName ());
7269 assertNotNull (Converter .CLASS .apply (this .getClass ().getTypeName ()), this .getClass ().getTypeName ());
73-
7470 assertThrows (ClassNotFoundException .class , () -> Converter .CLASS .apply ("foo.bar" ));
7571 assertNotNull (Converter .CLASS .apply (AClassWithoutADefaultConstructor .class .getName ()));
7672 }
77-
73+
7874 @ Test
7975 void testDate () throws Exception {
8076 assertThrows (java .text .ParseException .class , () -> Converter .DATE .apply ("whatever" ));
81-
8277 /*
83- * Dates calculated from strings are dependent upon configuration and environment settings for the
84- * machine on which the test is running. To avoid this problem, convert the time into a string
85- * and then unparse that using the converter. This produces strings that always match the correct
86- * time zone.
78+ * Dates calculated from strings are dependent upon configuration and environment settings for the machine on which the test is running. To avoid this
79+ * problem, convert the time into a string and then unparse that using the converter. This produces strings that always match the correct time zone.
8780 */
8881 final Date expected = new Date (1023400137000L );
8982 final DateFormat dateFormat = new SimpleDateFormat ("EEE MMM dd HH:mm:ss zzz yyyy" );
9083 final String formatted = dateFormat .format (expected );
9184 assertEquals (expected , Converter .DATE .apply (formatted ));
92-
9385 assertThrows (java .text .ParseException .class , () -> Converter .DATE .apply ("Jun 06 17:48:57 EDT 2002" ));
9486 }
9587
@@ -122,10 +114,8 @@ void testNumber(final String str, final Number expected) throws Exception {
122114 void testObject () throws Exception {
123115 assertNotNull (Converter .OBJECT .apply (this .getClass ().getName ()), this .getClass ().getName ());
124116 assertNotNull (Converter .OBJECT .apply (this .getClass ().getCanonicalName ()), this .getClass ().getCanonicalName ());
125- assertThrows (ClassNotFoundException .class , () -> Converter .OBJECT .apply (this .getClass ().getSimpleName ()),
126- this .getClass ().getSimpleName ());
117+ assertThrows (ClassNotFoundException .class , () -> Converter .OBJECT .apply (this .getClass ().getSimpleName ()), this .getClass ().getSimpleName ());
127118 assertNotNull (Converter .OBJECT .apply (this .getClass ().getTypeName ()), this .getClass ().getTypeName ());
128-
129119 assertThrows (ClassNotFoundException .class , () -> Converter .OBJECT .apply ("foo.bar" ));
130120 assertThrows (NoSuchMethodException .class , () -> Converter .OBJECT .apply (AClassWithoutADefaultConstructor .class .getName ()));
131121 }
0 commit comments