Skip to content

Commit f78bf22

Browse files
committed
Sort members
1 parent 1ab3011 commit f78bf22

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/test/java/org/apache/commons/cli/CommandLineTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
3131
@SuppressWarnings("deprecation") // tests some deprecated classes
3232
public 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"};

src/test/java/org/apache/commons/cli/OptionsTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,6 @@ public void testAddOptions2X() {
123123
assertThrows(IllegalArgumentException.class, () -> options.addOptions(options));
124124
}
125125

126-
@Test
127-
public void testDuplicateLong() {
128-
final Options opts = new Options();
129-
opts.addOption("a", "--a", false, "toggle -a");
130-
opts.addOption("a", "--a", false, "toggle -a*");
131-
assertEquals("toggle -a*", opts.getOption("a").getDescription(), "last one in wins");
132-
}
133-
134126
@Test
135127
public void testDeprecated() {
136128
final Options opts = new Options();
@@ -148,6 +140,14 @@ public void testDeprecated() {
148140
assertEquals("Option 'c': Deprecated for removal since 2.0: Use X.", opts.getOption("c").toDeprecatedString());
149141
}
150142

143+
@Test
144+
public void testDuplicateLong() {
145+
final Options opts = new Options();
146+
opts.addOption("a", "--a", false, "toggle -a");
147+
opts.addOption("a", "--a", false, "toggle -a*");
148+
assertEquals("toggle -a*", opts.getOption("a").getDescription(), "last one in wins");
149+
}
150+
151151
@Test
152152
public void testDuplicateSimple() {
153153
final Options opts = new Options();

0 commit comments

Comments
 (0)