commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r955289 - in /commons/proper/cli/trunk/src/test/java/org/apache/commons/cli: CommandLineTest.java bug/BugCLI71Test.java
Date Wed, 16 Jun 2010 16:27:04 GMT
Author: ebourg
Date: Wed Jun 16 16:27:03 2010
New Revision: 955289

URL: http://svn.apache.org/viewvc?rev=955289&view=rev
Log:
Improved the test coverage for the CommandLine class

Modified:
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java
    commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java?rev=955289&r1=955288&r2=955289&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/CommandLineTest.java Wed
Jun 16 16:27:03 2010
@@ -48,4 +48,17 @@ public class CommandLineTest extends Tes
 
         assertEquals("property with long format", "bar", cl.getOptionProperties("property").getProperty("foo"));
     }
+
+    public void testGetOptions()
+    {
+        CommandLine cmd = new CommandLine();
+        assertNotNull(cmd.getOptions());
+        assertEquals(0, cmd.getOptions().length);
+        
+        cmd.addOption(new Option("a", null));
+        cmd.addOption(new Option("b", null));
+        cmd.addOption(new Option("c", null));
+        
+        assertEquals(3, cmd.getOptions().length);
+    }
 }

Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java?rev=955289&r1=955288&r2=955289&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java (original)
+++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI71Test.java Wed
Jun 16 16:27:03 2010
@@ -78,7 +78,7 @@ public class BugCLI71Test extends TestCa
         CommandLine line = parser.parse( options, args);
         
         assertEquals( "Caesar", line.getOptionValue("a") );
-        assertEquals( "a", line.getOptionValue("k", "a") );
+        assertEquals( "a", line.getOptionValue('k', "a") );
     }
 
 }



Mime
View raw message