Skip to content

Commit f588f55

Browse files
committed
Improved the test coverage for the CommandLine class
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@955289 13f79535-47bb-0310-9956-ffa450edef68
1 parent d36b987 commit f588f55

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,17 @@ public void testGetOptionProperties() throws Exception
4848

4949
assertEquals("property with long format", "bar", cl.getOptionProperties("property").getProperty("foo"));
5050
}
51+
52+
public void testGetOptions()
53+
{
54+
CommandLine cmd = new CommandLine();
55+
assertNotNull(cmd.getOptions());
56+
assertEquals(0, cmd.getOptions().length);
57+
58+
cmd.addOption(new Option("a", null));
59+
cmd.addOption(new Option("b", null));
60+
cmd.addOption(new Option("c", null));
61+
62+
assertEquals(3, cmd.getOptions().length);
63+
}
5164
}

src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void testGetsDefaultIfOptional() throws Exception {
7878
CommandLine line = parser.parse( options, args);
7979

8080
assertEquals( "Caesar", line.getOptionValue("a") );
81-
assertEquals( "a", line.getOptionValue("k", "a") );
81+
assertEquals( "a", line.getOptionValue('k', "a") );
8282
}
8383

8484
}

0 commit comments

Comments
 (0)