You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2008/07/24 21:46:30 UTC
svn commit: r679516 -
/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/commandline/ParserTest.java
Author: oheger
Date: Thu Jul 24 12:46:30 2008
New Revision: 679516
URL: http://svn.apache.org/viewvc?rev=679516&view=rev
Log:
CLI-6: Added an additional test case to verify that unknown short options cause an exception.
Modified:
commons/proper/cli/trunk/src/test/org/apache/commons/cli2/commandline/ParserTest.java
Modified: commons/proper/cli/trunk/src/test/org/apache/commons/cli2/commandline/ParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/org/apache/commons/cli2/commandline/ParserTest.java?rev=679516&r1=679515&r2=679516&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/org/apache/commons/cli2/commandline/ParserTest.java (original)
+++ commons/proper/cli/trunk/src/test/org/apache/commons/cli2/commandline/ParserTest.java Thu Jul 24 12:46:30 2008
@@ -82,6 +82,17 @@
}
}
+ public void testParse_WithUnexpectedShortOption() {
+ try {
+ parser.parse(new String[]{"-vx"});
+ fail("OptionException");
+ }
+ catch(OptionException e) {
+ assertEquals(options,e.getOption());
+ assertEquals("Unexpected -x while processing --help|--verbose",e.getMessage());
+ }
+ }
+
public void testParseAndHelp_Successful() throws IOException {
final CommandLine cl = parser.parseAndHelp(new String[]{"-v"});