commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r680311 - in /commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli: OptionGroupTest.java OptionsTest.java
Date Mon, 28 Jul 2008 10:25:15 GMT
Author: ebourg
Date: Mon Jul 28 03:25:09 2008
New Revision: 680311

URL: http://svn.apache.org/viewvc?rev=680311&view=rev
Log:
Improved the test coverage for OptionGroup and Options

Modified:
    commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionGroupTest.java
    commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionsTest.java

Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionGroupTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionGroupTest.java?rev=680311&r1=680310&r2=680311&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionGroupTest.java
(original)
+++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionGroupTest.java
Mon Jul 28 03:25:09 2008
@@ -210,4 +210,15 @@
         assertEquals("[-f Foo, -b Bar]", group2.toString());
     }
 
+    public void testGetNames()
+    {
+        OptionGroup group = new OptionGroup();
+        group.addOption(OptionBuilder.create('a'));
+        group.addOption(OptionBuilder.create('b'));
+
+        assertNotNull("null names", group.getNames());
+        assertEquals(2, group.getNames().size());
+        assertTrue(group.getNames().contains("a"));
+        assertTrue(group.getNames().contains("b"));
+    }
 }

Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionsTest.java?rev=680311&r1=680310&r2=680311&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionsTest.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/OptionsTest.java Mon
Jul 28 03:25:09 2008
@@ -141,4 +141,22 @@
         assertTrue("bar option missing", s.toLowerCase().indexOf("bar") != -1);
     }
 
+    public void testGetOptionsGroups()
+    {
+        Options options = new Options();
+
+        OptionGroup group1 = new OptionGroup();
+        group1.addOption(OptionBuilder.create('a'));
+        group1.addOption(OptionBuilder.create('b'));
+
+        OptionGroup group2 = new OptionGroup();
+        group2.addOption(OptionBuilder.create('x'));
+        group2.addOption(OptionBuilder.create('y'));
+
+        options.addOptionGroup(group1);
+        options.addOptionGroup(group2);
+
+        assertNotNull(options.getOptionGroups());
+        assertEquals(2, options.getOptionGroups().size());
+    }
 }



Mime
View raw message