commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r679516 - /commons/proper/cli/trunk/src/test/org/apache/commons/cli2/commandline/ParserTest.java
Date Thu, 24 Jul 2008 19:46:30 GMT
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"});
         



Mime
View raw message