@@ -31,21 +31,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
3131@ SuppressWarnings ("deprecation" ) // tests some deprecated classes
3232public class CommandLineTest {
3333
34- @ Test
35- public void testDeprecatedOption () {
36- final CommandLine .Builder builder = new CommandLine .Builder ();
37- builder .addArg ("foo" ).addArg ("bar" );
38- final Option opt = Option .builder ().option ("T" ).deprecated ().build ();
39- builder .addOption (opt );
40- final AtomicReference <Option > handler = new AtomicReference <>();
41- final CommandLine cmd = builder .setDeprecatedHandler (handler ::set ).build ();
42- cmd .getOptionValue (opt .getOpt ());
43- assertSame (opt , handler .get ());
44- handler .set (null );
45- cmd .getOptionValue ("Nope" );
46- assertNull (handler .get ());
47- }
48-
4934 @ Test
5035 public void testBuilder () {
5136 final CommandLine .Builder builder = new CommandLine .Builder ();
@@ -83,6 +68,21 @@ public void testBuilderNullOption() {
8368 assertEquals (0 , cmd .getOptions ().length );
8469 }
8570
71+ @ Test
72+ public void testDeprecatedOption () {
73+ final CommandLine .Builder builder = new CommandLine .Builder ();
74+ builder .addArg ("foo" ).addArg ("bar" );
75+ final Option opt = Option .builder ().option ("T" ).deprecated ().build ();
76+ builder .addOption (opt );
77+ final AtomicReference <Option > handler = new AtomicReference <>();
78+ final CommandLine cmd = builder .setDeprecatedHandler (handler ::set ).build ();
79+ cmd .getOptionValue (opt .getOpt ());
80+ assertSame (opt , handler .get ());
81+ handler .set (null );
82+ cmd .getOptionValue ("Nope" );
83+ assertNull (handler .get ());
84+ }
85+
8686 @ Test
8787 public void testGetOptionProperties () throws Exception {
8888 final String [] args = {"-Dparam1=value1" , "-Dparam2=value2" , "-Dparam3" , "-Dparam4=value4" , "-D" , "--property" , "foo=bar" };
0 commit comments