Skip to content

Commit 665386d

Browse files
committed
Renamed the test case LongOptionWithShort into PosixParserTest to make it executed by Maven
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x@661363 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2490250 commit 665386d

1 file changed

Lines changed: 12 additions & 20 deletions

File tree

src/test/org/apache/commons/cli/LongOptionWithShort.java renamed to src/test/org/apache/commons/cli/PosixParserTest.java

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@
2424
* applications command lines focusing on options with
2525
* long and short names.
2626
*/
27-
public class LongOptionWithShort extends TestCase {
27+
public class PosixParserTest extends TestCase {
2828

29-
public void testLongOptionWithShort() {
29+
public void testLongOptionWithShort() throws Exception {
3030
Option help = new Option("h", "help", false, "print this message");
31-
Option version = new Option("v", "version", false,
32-
"print version information");
33-
Option newRun = new Option("n", "new", false,
34-
"Create NLT cache entries only for new items");
35-
Option trackerRun = new Option("t", "tracker", false,
36-
"Create NLT cache entries only for tracker items");
31+
Option version = new Option("v", "version", false, "print version information");
32+
Option newRun = new Option("n", "new", false, "Create NLT cache entries only for new items");
33+
Option trackerRun = new Option("t", "tracker", false, "Create NLT cache entries only for tracker items");
3734

3835
Option timeLimit = OptionBuilder.withLongOpt("limit").hasArg()
3936
.withValueSeparator()
@@ -84,17 +81,12 @@ public void testLongOptionWithShort() {
8481
"filename"
8582
};
8683

87-
try {
88-
CommandLine line = parser.parse(options, args);
89-
assertTrue(line.hasOption("v"));
90-
assertEquals(line.getOptionValue("l"), "10");
91-
assertEquals(line.getOptionValue("limit"), "10");
92-
assertEquals(line.getOptionValue("a"), "5");
93-
assertEquals(line.getOptionValue("age"), "5");
94-
assertEquals(line.getOptionValue("file"), "filename");
95-
}
96-
catch (ParseException exp) {
97-
fail("Unexpected exception:" + exp.getMessage());
98-
}
84+
CommandLine line = parser.parse(options, args);
85+
assertTrue(line.hasOption("v"));
86+
assertEquals(line.getOptionValue("l"), "10");
87+
assertEquals(line.getOptionValue("limit"), "10");
88+
assertEquals(line.getOptionValue("a"), "5");
89+
assertEquals(line.getOptionValue("age"), "5");
90+
assertEquals(line.getOptionValue("file"), "filename");
9991
}
10092
}

0 commit comments

Comments
 (0)