http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/ArgumentTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/ArgumentTest.java 
b/src/test/org/apache/commons/cli2/option/ArgumentTest.java
deleted file mode 100644
index 215e1ae..0000000
--- a/src/test/org/apache/commons/cli2/option/ArgumentTest.java
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import java.text.ParseException;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
-import org.apache.commons.cli2.Argument;
-import org.apache.commons.cli2.DisplaySetting;
-import org.apache.commons.cli2.HelpLine;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.WriteableCommandLine;
-import org.apache.commons.cli2.builder.ArgumentBuilder;
-import org.apache.commons.cli2.builder.GroupBuilder;
-import org.apache.commons.cli2.commandline.WriteableCommandLineImpl;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.resource.ResourceHelper;
-import org.apache.commons.cli2.validation.DateValidator;
-import org.apache.commons.cli2.validation.DateValidatorTest;
-
-/**
- * @author Rob Oxspring
- */
-public class ArgumentTest
-    extends ArgumentTestCase {
-    private ResourceHelper resources = ResourceHelper.getResourceHelper();
-
-    public static Argument buildUsernameArgument() {
-        return new ArgumentImpl("username", "The user to connect as", 1, 1, 
'\0', '\0', null,
-                                ArgumentImpl.DEFAULT_CONSUME_REMAINING, null, 
0);
-    }
-
-    public static Argument buildHostArgument() {
-        return new ArgumentImpl("host", "The host name", 2, 3, '\0', ',', 
null, null, null, 0);
-    }
-
-    public static Argument buildPathArgument() {
-        return new ArgumentImpl("path", "The place to look for files", 1, 
Integer.MAX_VALUE, '=',
-                                ';', null, 
ArgumentImpl.DEFAULT_CONSUME_REMAINING, null, 0);
-    }
-
-    public static Argument buildDateLimitArgument() {
-        return new ArgumentImpl("limit", "the last acceptable date", 0, 1, 
'=', '\0',
-                                new 
DateValidator(DateValidatorTest.YYYY_MM_DD), null, null, 0);
-    }
-
-    public static Argument buildTargetsArgument() {
-        return new ArgumentImpl("target", "The targets ant should build", 0, 
Integer.MAX_VALUE,
-                                '\0', ',', null, null, null, 0);
-    }
-
-    public static Argument buildSizeArgument() {
-        List defaults = new ArrayList();
-        defaults.add("10");
-
-        return new ArgumentImpl("size", "The number of units", 1, 1, '\0', 
'\0', null,
-                                ArgumentImpl.DEFAULT_CONSUME_REMAINING, 
defaults, 0);
-    }
-
-    public static Argument buildBoundsArgument() {
-        List defaults = new ArrayList();
-        defaults.add("5");
-        defaults.add("10");
-
-        return new ArgumentImpl("size", "The number of units", 2, 2, '\0', 
'\0', null,
-                                ArgumentImpl.DEFAULT_CONSUME_REMAINING, 
defaults, 0);
-    }
-
-    public void testNew() {
-        try {
-            new ArgumentImpl("limit", "the last acceptable date", 10, 5, '=', 
'\0',
-                             new DateValidator(DateValidatorTest.YYYY_MM_DD), 
null, null, 0);
-        } catch (IllegalArgumentException e) {
-            
assertEquals(resources.getMessage("Argument.minimum.exceeds.maximum"), 
e.getMessage());
-        }
-
-        {
-            ArgumentImpl arg =
-                new ArgumentImpl(null, "the last acceptable date", 5, 5, '=', 
'\0',
-                                 new 
DateValidator(DateValidatorTest.YYYY_MM_DD), null, null, 0);
-            assertEquals("wrong arg name", "arg", arg.getPreferredName());
-        }
-
-        {
-            List defaults = new ArrayList();
-
-            try {
-                new ArgumentImpl(null, "the last acceptable date", 1, 1, '=', 
'\0',
-                                 new 
DateValidator(DateValidatorTest.YYYY_MM_DD), null, defaults, 0);
-            } catch (IllegalArgumentException exp) {
-                
assertEquals(resources.getMessage("Argument.too.few.defaults"), 
exp.getMessage());
-            }
-        }
-
-        try {
-            List defaults = new ArrayList();
-            defaults.add("1");
-            defaults.add("2");
-
-            new ArgumentImpl(null, "the last acceptable date", 1, 1, '=', '\0',
-                             new DateValidator(DateValidatorTest.YYYY_MM_DD), 
null, defaults, 0);
-        } catch (IllegalArgumentException exp) {
-            assertEquals(resources.getMessage("Argument.too.many.defaults"), 
exp.getMessage());
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.ArgumentTestCase#testProcessValues()
-     */
-    public void testProcessValues()
-        throws OptionException {
-        final Argument option = buildUsernameArgument();
-        final List args = list("rob");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processValues(commandLine, iterator, option);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("username"));
-        assertEquals("rob", commandLine.getValue(option));
-    }
-
-    public void testProcessValues_BoundaryQuotes()
-        throws OptionException {
-        final Argument option = buildUsernameArgument();
-        final List args = list("\"rob\"");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processValues(commandLine, iterator, option);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("username"));
-        assertEquals("rob", commandLine.getValue(option));
-    }
-
-    public void testProcessValues_SpareValues()
-        throws OptionException {
-        final Argument option = buildUsernameArgument();
-        final List args = list("rob", "secret");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processValues(commandLine, iterator, option);
-
-        assertTrue(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("username"));
-        assertEquals("rob", commandLine.getValue(option));
-    }
-
-    public void testProcessValues_Optional() {
-        final Argument option = buildTargetsArgument();
-        final List args = list();
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-
-        try {
-            option.processValues(commandLine, iterator, option);
-        } catch (final OptionException mve) {
-            assertEquals(option, mve.getOption());
-            assertEquals("Missing value(s) target [target ...]", 
mve.getMessage());
-        }
-
-        assertFalse(iterator.hasNext());
-        assertFalse(commandLine.hasOption(option));
-        assertFalse(commandLine.hasOption("username"));
-        assertTrue(commandLine.getValues(option).isEmpty());
-    }
-
-    public void testProcessValues_Multiple()
-        throws OptionException {
-        final Argument option = buildTargetsArgument();
-        final List args = list("compile", "test", "docs");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processValues(commandLine, iterator, option);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("target"));
-        assertFalse(commandLine.getValues(option).isEmpty());
-        assertListContentsEqual(args, commandLine.getValues(option));
-    }
-
-    public void testProcessValues_Contracted()
-        throws OptionException {
-        final Argument option = buildTargetsArgument();
-        final List args = list("compile,test,javadoc", "checkstyle,jdepend");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processValues(commandLine, iterator, option);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("target"));
-        assertListContentsEqual(list("compile", "test", "javadoc", 
"checkstyle", "jdepend"),
-                                commandLine.getValues(option));
-    }
-
-    public void testProcessValues_ContractedTooFew() {
-        final Argument option = buildHostArgument();
-        final List args = list("box1");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-
-        try {
-            option.processValues(commandLine, iterator, option);
-            option.validate(commandLine);
-            fail("Expected MissingValueException");
-        } catch (OptionException mve) {
-            assertSame(option, mve.getOption());
-        }
-    }
-
-    public void testProcessValues_ContractedTooMany() {
-        final Argument option = buildHostArgument();
-        final List args = list("box1,box2,box3,box4");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-
-        try {
-            option.processValues(commandLine, iterator, option);
-            option.validate(commandLine);
-            fail("Expected MissingValueException");
-        } catch (OptionException mve) {
-            assertSame(option, mve.getOption());
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testCanProcess()
-     */
-    public void testCanProcess() {
-        final Argument option = buildTargetsArgument();
-        assertTrue(option.canProcess(new WriteableCommandLineImpl(option, 
null), "any value"));
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testPrefixes()
-     */
-    public void testPrefixes() {
-        final Argument option = buildTargetsArgument();
-        assertTrue(option.getPrefixes().isEmpty());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testProcess()
-     */
-    public void testProcess()
-        throws OptionException {
-        final Argument option = buildPathArgument();
-        final List args = list("-path=/lib;/usr/lib;/usr/local/lib");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.process(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("path"));
-        assertListContentsEqual(list("-path=/lib", "/usr/lib", 
"/usr/local/lib"),
-                                commandLine.getValues(option));
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testTriggers()
-     */
-    public void testTriggers() {
-        final Argument option = buildTargetsArgument();
-        assertTrue(option.getTriggers().isEmpty());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testValidate()
-     */
-    public void testValidate()
-        throws OptionException {
-        final Argument option = buildUsernameArgument();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        commandLine.addValue(option, "rob");
-
-        option.validate(commandLine);
-    }
-
-    public void testValidate_Minimum() {
-        final Argument option = buildUsernameArgument();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        try {
-            option.validate(commandLine);
-            fail("UnexpectedValue");
-        } catch (OptionException mve) {
-            assertEquals(option, mve.getOption());
-        }
-    }
-
-    public void testRequired() {
-        {
-            final Argument arg = buildBoundsArgument();
-
-            assertTrue("not required", arg.isRequired());
-        }
-
-        {
-            final Argument arg = buildTargetsArgument();
-
-            assertFalse("should not be required", arg.isRequired());
-        }
-    }
-
-    public void testValidate_Maximum() {
-        final Argument option = buildUsernameArgument();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        commandLine.addValue(option, "rob");
-        commandLine.addValue(option, "oxspring");
-
-        try {
-            option.validate(commandLine);
-            fail("UnexpectedValue");
-        } catch (OptionException uve) {
-            assertEquals(option, uve.getOption());
-        }
-    }
-
-    public void testValidate_Validator()
-        throws OptionException, ParseException {
-        final Argument option = buildDateLimitArgument();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        commandLine.addValue(option, "2004-01-01");
-
-        option.validate(commandLine, option);
-        assertContentsEqual(Arrays.asList(new Object[] {
-                                              
DateValidatorTest.YYYY_MM_DD.parse("2004-01-01")
-                                          }), commandLine.getValues(option));
-    }
-
-    public void testValidate_ValidatorInvalidDate()
-        throws OptionException, ParseException {
-        final Argument option = buildDateLimitArgument();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        commandLine.addValue(option, "12-12-2004");
-
-        try {
-            option.validate(commandLine, option);
-        } catch (OptionException exp) {
-            OptionException e =
-                new OptionException(option, 
ResourceConstants.ARGUMENT_UNEXPECTED_VALUE,
-                                    "12-12-2004");
-            assertEquals("wrong exception message", e.getMessage(), 
exp.getMessage());
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testAppendUsage()
-     */
-    public void testAppendUsage() {
-        final Option option = buildUsernameArgument();
-        final StringBuffer buffer = new StringBuffer();
-        option.appendUsage(buffer, DisplaySetting.ALL, null);
-
-        assertEquals("<username>", buffer.toString());
-    }
-
-    public void testAppendUsage_Infinite() {
-        final Option option = buildTargetsArgument();
-        final StringBuffer buffer = new StringBuffer();
-        option.appendUsage(buffer, DisplaySetting.ALL, null);
-
-        assertEquals("[<target1> [<target2> ...]]", buffer.toString());
-    }
-
-    public void testAppendUsage_InfiniteNoOptional() {
-        final Option option = buildTargetsArgument();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_OPTIONAL);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("<target1> [<target2> ...]", buffer.toString());
-    }
-
-    public void testAppendUsage_InfiniteNoNumbering() {
-        final Option option = buildTargetsArgument();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_ARGUMENT_NUMBERED);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("[<target> [<target> ...]]", buffer.toString());
-    }
-
-    public void testAppendUsage_Minimum() {
-        final Option option = buildHostArgument();
-        final StringBuffer buffer = new StringBuffer();
-        option.appendUsage(buffer, DisplaySetting.ALL, null);
-
-        assertEquals("<host1> <host2> [<host3>]", buffer.toString());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testGetPreferredName()
-     */
-    public void testGetPreferredName() {
-        final Option option = buildPathArgument();
-        assertEquals("path", option.getPreferredName());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testGetDescription()
-     */
-    public void testGetDescription() {
-        final Option option = buildHostArgument();
-        assertEquals("The host name", option.getDescription());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testHelpLines()
-     */
-    public void testHelpLines() {
-        final Option option = buildHostArgument();
-        final List lines = option.helpLines(0, DisplaySetting.ALL, null);
-        final Iterator i = lines.iterator();
-
-        final HelpLine line1 = (HelpLine) i.next();
-        assertEquals(0, line1.getIndent());
-        assertEquals(option, line1.getOption());
-
-        assertFalse(i.hasNext());
-    }
-
-    public void testCanProcess_ConsumeRemaining() {
-        final Option option = buildUsernameArgument();
-
-        assertTrue(option.canProcess(new WriteableCommandLineImpl(option, 
null), "--"));
-    }
-
-    public void testProcess_ConsumeRemaining()
-        throws OptionException {
-        final Option option = buildPathArgument();
-        final List args = list("options", "--", "--ignored", "-Dprop=val");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-
-        option.process(commandLine, iterator);
-
-        final List values = commandLine.getValues(option);
-        assertTrue(values.contains("options"));
-        assertTrue(values.contains("--ignored"));
-        assertTrue(values.contains("-Dprop=val"));
-        assertEquals(3, values.size());
-        assertFalse(iterator.hasNext());
-    }
-
-    public void testProcess_ConsumeNothing() {
-        final Option option = buildPathArgument();
-        final List args = list("--");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-
-        try {
-            option.process(commandLine, iterator);
-            option.validate(commandLine);
-            fail("Missing Value!");
-        } catch (OptionException mve) {
-            assertEquals(option, mve.getOption());
-            assertEquals("Missing value(s) path [path ...]", mve.getMessage());
-        }
-
-        assertTrue(commandLine.getValues(option).isEmpty());
-        assertFalse(iterator.hasNext());
-    }
-
-    //    public void testProcess_DefinedDefaultValue() throws OptionException 
{
-    //        final Option size = buildSizeArgument();
-    //        final List args = list();
-    //        final WriteableCommandLine commandLine = commandLine(size, args);
-    //        final ListIterator iterator = args.listIterator();
-    //
-    //        size.process(commandLine, iterator);
-    //
-    //        assertEquals("10", commandLine.getValue(size));
-    //    }
-    //
-    //    public void testProcess_DefinedDefaultValues() throws 
OptionException {
-    //        final Option bounds = buildBoundsArgument();
-    //        final List args = list();
-    //        final WriteableCommandLine commandLine = commandLine(bounds, 
args);
-    //        final ListIterator iterator = args.listIterator();
-    //
-    //        bounds.process(commandLine, iterator);
-    //
-    //        List values = new ArrayList();
-    //        values.add("5");
-    //        values.add("10");
-    //        assertEquals(values, commandLine.getValues(bounds));
-    //    }
-    public void testProcess_InterrogatedDefaultValue()
-        throws OptionException {
-        final Option size = buildSizeArgument();
-        final List args = list();
-        final WriteableCommandLine commandLine = commandLine(size, args);
-        final ListIterator iterator = args.listIterator();
-
-        size.process(commandLine, iterator);
-
-        assertEquals(new Integer(20), commandLine.getValue(size, new 
Integer(20)));
-    }
-
-    public void testTooFewDefaults() {
-        List defaults = new ArrayList();
-        defaults.add("5");
-
-        try {
-            new ArgumentImpl("size", "The number of units", 2, 2, '\0', '\0', 
null,
-                             ArgumentImpl.DEFAULT_CONSUME_REMAINING, defaults, 
0);
-        } catch (IllegalArgumentException exp) {
-            assertEquals("wrong exception message",
-                         
ResourceHelper.getResourceHelper().getMessage(ResourceConstants.ARGUMENT_TOO_FEW_DEFAULTS),
-                         exp.getMessage());
-        }
-    }
-
-    public void testTooManyDefaults() {
-        List defaults = new ArrayList();
-        defaults.add("5");
-        defaults.add("10");
-        defaults.add("15");
-
-        try {
-            new ArgumentImpl("size", "The number of units", 2, 2, '\0', '\0', 
null,
-                             ArgumentImpl.DEFAULT_CONSUME_REMAINING, defaults, 
0);
-        } catch (IllegalArgumentException exp) {
-            assertEquals("wrong exception message",
-                         
ResourceHelper.getResourceHelper().getMessage(ResourceConstants.ARGUMENT_TOO_MANY_DEFAULTS),
-                         exp.getMessage());
-        }
-    }
-
-    public void testProcess_InterrogatedDefaultValues()
-        throws OptionException {
-        final Option bounds = buildBoundsArgument();
-        final List args = list();
-        final WriteableCommandLine commandLine = commandLine(bounds, args);
-        final ListIterator iterator = args.listIterator();
-
-        bounds.process(commandLine, iterator);
-
-        // test with values
-        List values = new ArrayList();
-        values.add("50");
-        values.add("100");
-        assertEquals(values, commandLine.getValues(bounds, values));
-
-        // test without values
-        assertEquals(Collections.EMPTY_LIST, commandLine.getValues(bounds, 
null));
-    }
-
-    public void testProcess_StripBoundaryQuotes()
-        throws OptionException {
-        final Option bounds = buildBoundsArgument();
-        final List args = list();
-        final WriteableCommandLine commandLine = commandLine(bounds, args);
-        final ListIterator iterator = args.listIterator();
-
-        bounds.process(commandLine, iterator);
-
-        List values = new ArrayList();
-        values.add("50\"");
-        values.add("\"100");
-        assertEquals(values, commandLine.getValues(bounds, values));
-    }
-
-    public void testSourceDestArgument() {
-        final ArgumentBuilder abuilder = new ArgumentBuilder();
-        final GroupBuilder gbuilder = new GroupBuilder();
-        final Argument inputfiles =
-            abuilder.withName("input").withMinimum(0).withMaximum(0).create();
-        final Argument bad_outputfile =
-            abuilder.withName("output").withMinimum(1).withMaximum(2).create();
-
-        try {
-            final Argument targets = new SourceDestArgument(inputfiles, 
bad_outputfile);
-        } catch (final IllegalArgumentException exp) {
-            assertEquals("wrong exception message",
-                         
ResourceHelper.getResourceHelper().getMessage(ResourceConstants.SOURCE_DEST_MUST_ENFORCE_VALUES),
-                         exp.getMessage());
-        }
-
-        final Argument outputfile =
-            abuilder.withName("output").withMinimum(1).withMaximum(1).create();
-
-        final Argument targets = new SourceDestArgument(inputfiles, 
outputfile);
-        final StringBuffer buffer = new StringBuffer("test content");
-        targets.appendUsage(buffer, Collections.EMPTY_SET, null);
-
-        assertTrue("buffer not added", buffer.toString().startsWith("test 
content"));
-        assertFalse("space added", buffer.charAt(12) == ' ');
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/ArgumentTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/ArgumentTestCase.java 
b/src/test/org/apache/commons/cli2/option/ArgumentTestCase.java
deleted file mode 100644
index abd481f..0000000
--- a/src/test/org/apache/commons/cli2/option/ArgumentTestCase.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import org.apache.commons.cli2.OptionException;
-
-/**
- * @author Rob Oxspring
- */
-public abstract class ArgumentTestCase extends OptionTestCase {
-
-    public abstract void testProcessValues() throws OptionException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/CommandTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/CommandTest.java 
b/src/test/org/apache/commons/cli2/option/CommandTest.java
deleted file mode 100644
index 6c76930..0000000
--- a/src/test/org/apache/commons/cli2/option/CommandTest.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/**
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
-import org.apache.commons.cli2.DisplaySetting;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.Parent;
-import org.apache.commons.cli2.WriteableCommandLine;
-import org.apache.commons.cli2.commandline.WriteableCommandLineImpl;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.resource.ResourceHelper;
-
-/**
- * @author Rob Oxspring
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class CommandTest
-    extends ParentTestCase {
-    public static Command buildStartCommand() {
-        return new Command("start", "Begins the process", 
Collections.singleton("go"), false, null,
-                           null, 0);
-    }
-
-    public static Command buildCommitCommand() {
-        return new Command("commit", "Commit the changes to the database", 
null, true, null, null, 0);
-    }
-
-    public static Command buildLoginCommand() {
-        return new Command("login", "Initiates a session for the user", null, 
false,
-                           ArgumentTest.buildUsernameArgument(), null, 0);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.ParentTestCase#testProcessParent()
-     */
-    public void testProcessParent()
-        throws OptionException {
-        final Command option = buildStartCommand();
-        final List args = list("go");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processParent(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("start"));
-        assertTrue(commandLine.hasOption("go"));
-        assertTrue(commandLine.getValues(option).isEmpty());
-    }
-
-    public void testProcessParent_Spare()
-        throws OptionException {
-        final Command option = buildLoginCommand();
-        final List args = list("login", "rob");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processParent(commandLine, iterator);
-
-        assertEquals("rob", iterator.next());
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("login"));
-        assertTrue(commandLine.getValues(option).isEmpty());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testCanProcess()
-     */
-    public void testCanProcess() {
-        final Command option = buildStartCommand();
-        assertTrue(option.canProcess(new WriteableCommandLineImpl(option, 
null), "start"));
-    }
-
-    public void testCanProcess_BadMatch() {
-        final Command option = buildStartCommand();
-        assertFalse(option.canProcess(new WriteableCommandLineImpl(option, 
null), "stop"));
-    }
-
-    public void testCanProcess_Alias() {
-        final Command option = buildStartCommand();
-        assertTrue(option.canProcess(new WriteableCommandLineImpl(option, 
null), "go"));
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testPrefixes()
-     */
-    public void testPrefixes() {
-        final Command option = buildStartCommand();
-        assertTrue(option.getPrefixes().isEmpty());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testProcess()
-     */
-    public void testProcess()
-        throws OptionException {
-        final Command option = buildLoginCommand();
-        final List args = list("login", "rob");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.process(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("login"));
-        assertEquals("rob", commandLine.getValue(option));
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testTriggers()
-     */
-    public void testTriggers() {
-        final Command option = buildStartCommand();
-        final Set triggers = option.getTriggers();
-        assertContentsEqual(list("start", "go"), triggers);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testValidate()
-     */
-    public void testValidate() {
-        final Parent option = buildCommitCommand();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        try {
-            option.validate(commandLine);
-            fail("Missing an option");
-        } catch (OptionException moe) {
-            assertSame(option, moe.getOption());
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testAppendUsage()
-     */
-    public void testAppendUsage() {
-        final Option option = buildStartCommand();
-        final StringBuffer buffer = new StringBuffer();
-        option.appendUsage(buffer, DisplaySetting.ALL, null);
-
-        assertEquals("[start (go)]", buffer.toString());
-    }
-
-    public void testNullPreferredName() {
-        try {
-            new Command(null, "", Collections.singleton("go"), false, null, 
null, 0);
-        } catch (IllegalArgumentException exp) {
-            assertEquals("wrong exception name",
-                         
ResourceHelper.getResourceHelper().getMessage(ResourceConstants.COMMAND_PREFERRED_NAME_TOO_SHORT),
-                         exp.getMessage());
-        }
-    }
-
-    public void testEmotyPreferredName() {
-        try {
-            new Command("", "", Collections.singleton("go"), false, null, 
null, 0);
-        } catch (IllegalArgumentException exp) {
-            assertEquals("wrong exception name",
-                         
ResourceHelper.getResourceHelper().getMessage(ResourceConstants.COMMAND_PREFERRED_NAME_TOO_SHORT),
-                         exp.getMessage());
-        }
-    }
-
-    public void testAppendUsage_NoOptional() {
-        final Option option = buildStartCommand();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_OPTIONAL);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("start (go)", buffer.toString());
-    }
-
-    public void testAppendUsage_NoAlias() {
-        final Option option = buildStartCommand();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_ALIASES);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("[start]", buffer.toString());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testGetPreferredName()
-     */
-    public void testGetPreferredName() {
-        final Option option = buildStartCommand();
-        assertEquals("start", option.getPreferredName());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testGetDescription()
-     */
-    public void testGetDescription() {
-        final Option option = buildLoginCommand();
-        assertEquals("Initiates a session for the user", 
option.getDescription());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testHelpLines()
-     */
-    public void testHelpLines() {
-        // TODO Auto-generated method stub
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/DefaultOptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/DefaultOptionTest.java 
b/src/test/org/apache/commons/cli2/option/DefaultOptionTest.java
deleted file mode 100644
index d9dfa00..0000000
--- a/src/test/org/apache/commons/cli2/option/DefaultOptionTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/**
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
-import org.apache.commons.cli2.DisplaySetting;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.Parent;
-import org.apache.commons.cli2.WriteableCommandLine;
-import org.apache.commons.cli2.commandline.WriteableCommandLineImpl;
-
-/**
- * @author roberto
- * 
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class DefaultOptionTest extends ParentTestCase {
-
-    public static DefaultOption buildHelpOption() {
-        final Set aliases = new HashSet(list("-h", "-?"));
-        return new DefaultOption(
-            "-",
-            "--",
-            true,
-            "--help",
-            "Displays the help",
-            aliases,
-            aliases,
-            false,
-            null,
-            null,
-            'h');
-    }
-
-    public static DefaultOption buildXOption() {
-        return new DefaultOption(
-            "-",
-            "--",
-            true,
-            "-X",
-            "This is needed",
-            null,
-            null,
-            true,
-            null,
-            null,
-            'X');
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.ParentTestCase#testProcessParent()
-     */
-    public void testProcessParent() throws OptionException {
-        final DefaultOption option = buildHelpOption();
-        final List args = list("--help");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processParent(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("--help"));
-        assertTrue(commandLine.hasOption("-?"));
-        assertTrue(commandLine.getValues(option).isEmpty());
-    }
-
-    public void testProcessParent_Burst() throws OptionException {
-        final DefaultOption option = buildHelpOption();
-        final List args = list("-help");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processParent(commandLine, iterator);
-
-        assertEquals("-elp", iterator.next());
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("--help"));
-        assertTrue(commandLine.hasOption("-?"));
-        assertTrue(commandLine.getValues(option).isEmpty());
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testCanProcess()
-     */
-    public void testCanProcess() {
-        final DefaultOption option = buildHelpOption();
-        assertTrue(option.canProcess(new 
WriteableCommandLineImpl(option,null), "-?"));
-    }
-
-    public void testCanProcess_BadMatch() {
-        final DefaultOption option = buildHelpOption();
-        assertFalse(option.canProcess(new 
WriteableCommandLineImpl(option,null), "-H"));
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testPrefixes()
-     */
-    public void testPrefixes() {
-        final DefaultOption option = buildHelpOption();
-        assertContentsEqual(list("-", "--"), option.getPrefixes());
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testProcess()
-     */
-    public void testProcess() {
-        // TODO Auto-generated method stub
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testTriggers()
-     */
-    public void testTriggers() {
-        final DefaultOption option = buildHelpOption();
-        assertContentsEqual(list("-?", "-h", "--help"), option.getTriggers());
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testValidate()
-     */
-    public void testValidate() {
-        final Parent option = buildXOption();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        try {
-            option.validate(commandLine);
-            fail("Missing an option");
-        }
-        catch (OptionException moe) {
-            assertSame(option, moe.getOption());
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testAppendUsage()
-     */
-    public void testAppendUsage() {
-        final Option option = buildHelpOption();
-        final StringBuffer buffer = new StringBuffer();
-        option.appendUsage(buffer, DisplaySetting.ALL, null);
-
-        assertEquals("[--help (-?,-h)]", buffer.toString());
-    }
-
-    public void testAppendUsage_NoOptional() {
-        final Option option = buildHelpOption();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_OPTIONAL);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("--help (-?,-h)", buffer.toString());
-    }
-
-    public void testAppendUsage_NoAlias() {
-        final Option option = buildHelpOption();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_ALIASES);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("[--help]", buffer.toString());
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testGetPreferredName()
-     */
-    public void testGetPreferredName() {
-        final Option option = buildHelpOption();
-        assertEquals("--help", option.getPreferredName());
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testGetDescription()
-     */
-    public void testGetDescription() {
-        final Option option = buildHelpOption();
-        assertEquals("Displays the help", option.getDescription());
-    }
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.cli2.OptionTestCase#testHelpLines()
-     */
-    public void testHelpLines() {
-        // TODO Auto-generated method stub
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/GroupTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/GroupTest.java 
b/src/test/org/apache/commons/cli2/option/GroupTest.java
deleted file mode 100644
index f7686b8..0000000
--- a/src/test/org/apache/commons/cli2/option/GroupTest.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
-import org.apache.commons.cli2.DisplaySetting;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.HelpLine;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.WriteableCommandLine;
-import org.apache.commons.cli2.builder.DefaultOptionBuilder;
-import org.apache.commons.cli2.builder.GroupBuilder;
-import org.apache.commons.cli2.commandline.WriteableCommandLineImpl;
-
-/**
- * @author Rob Oxspring
- */
-public class GroupTest
-    extends GroupTestCase {
-    public static final Command COMMAND_START =
-        new Command("start", "Starts the server", null, false, null, null, 0);
-    public static final Command COMMAND_STOP =
-        new Command("stop", "Stops the server", null, false, null, null, 0);
-    public static final Command COMMAND_RESTART =
-        new Command("restart", "Stops and starts the server", null, false, 
null, null, 0);
-    public static final Command COMMAND_GRACEFUL =
-        new Command("graceful", "Restarts the server without interruption", 
null, false, null,
-                    null, 0);
-
-    public static Group buildApacheCommandGroup() {
-        final List options = new ArrayList();
-        options.add(COMMAND_GRACEFUL);
-        options.add(COMMAND_RESTART);
-        options.add(COMMAND_START);
-        options.add(COMMAND_STOP);
-
-        return new GroupImpl(options, "httpd-cmds", "The command to pass to 
the server", 1, 1);
-    }
-
-    public static Group buildApachectlGroup() {
-        final List options = new ArrayList();
-        options.add(DefaultOptionTest.buildHelpOption());
-        options.add(ParentTest.buildKParent());
-
-        return new GroupImpl(options, "apachectl", "Controls the apache http 
deamon", 0,
-                             Integer.MAX_VALUE);
-    }
-
-    public static Group buildAntGroup() {
-        final List options = new ArrayList();
-        options.add(DefaultOptionTest.buildHelpOption());
-        options.add(ArgumentTest.buildTargetsArgument());
-
-        return new GroupImpl(options, "ant", "The options for ant", 0, 
Integer.MAX_VALUE);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see 
org.apache.commons.cli2.GroupTestCase#testProcessAnonymousArguments()
-     */
-    public void testProcessAnonymousArguments()
-        throws OptionException {
-        final Group option = buildAntGroup();
-        final List args = list("compile,test", "dist");
-        final ListIterator iterator = args.listIterator();
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        option.process(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption("target"));
-        assertListContentsEqual(commandLine.getValues("target"), args);
-        assertListContentsEqual(list("compile", "test", "dist"), args);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.GroupTestCase#testProcessOptions()
-     */
-    public void testProcessOptions()
-        throws OptionException {
-        final Group option = buildApachectlGroup();
-        final List args = list("-?", "-k");
-        final ListIterator iterator = args.listIterator();
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        option.process(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption("--help"));
-        assertTrue(commandLine.hasOption("-k"));
-        assertFalse(commandLine.hasOption("start"));
-        assertListContentsEqual(list("--help", "-k"), args);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testCanProcess()
-     */
-    public void testCanProcess() {
-        final Group option = buildApacheCommandGroup();
-        assertTrue(option.canProcess(new WriteableCommandLineImpl(option, 
null), "start"));
-    }
-
-    public void testCanProcess_BadMatch() {
-        final Group option = buildApacheCommandGroup();
-        assertFalse(option.canProcess(new WriteableCommandLineImpl(option, 
null), "begin"));
-    }
-
-    public void testCanProcess_NullMatch() {
-        final Group option = buildApacheCommandGroup();
-        assertFalse(option.canProcess(new WriteableCommandLineImpl(option, 
null), (String) null));
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testPrefixes()
-     */
-    public void testPrefixes() {
-        final Group option = buildApachectlGroup();
-        assertContentsEqual(list("-", "--"), option.getPrefixes());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testProcess()
-     */
-    public void testProcess()
-        throws OptionException {
-        final Group option = buildAntGroup();
-        final List args = list("--help", "compile,test", "dist");
-        final ListIterator iterator = args.listIterator();
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        option.process(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption("-?"));
-        assertListContentsEqual(list("compile", "test", "dist"), 
commandLine.getValues("target"));
-    }
-
-    public void testProcess_Nested()
-        throws OptionException {
-        final Group option = buildApachectlGroup();
-        final List args = list("-h", "-k", "graceful");
-        final ListIterator iterator = args.listIterator();
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        option.process(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption("-?"));
-        assertTrue(commandLine.hasOption("-k"));
-        assertTrue(commandLine.hasOption("graceful"));
-        assertFalse(commandLine.hasOption("stop"));
-        assertTrue(commandLine.getValues("start").isEmpty());
-        assertListContentsEqual(list("--help", "-k", "graceful"), args);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testTriggers()
-     */
-    public void testTriggers() {
-        final Group option = buildApachectlGroup();
-        assertContentsEqual(list("--help", "-?", "-h", "-k"), 
option.getTriggers());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testValidate()
-     */
-    public void testValidate()
-        throws OptionException {
-        final Group option = buildApacheCommandGroup();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        commandLine.addOption(COMMAND_RESTART);
-
-        option.validate(commandLine);
-    }
-
-    public void testValidate_UnexpectedOption() {
-        final Group option = buildApacheCommandGroup();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        commandLine.addOption(COMMAND_RESTART);
-        commandLine.addOption(COMMAND_GRACEFUL);
-
-        try {
-            option.validate(commandLine);
-            fail("Too many options");
-        } catch (OptionException uoe) {
-            assertEquals(option, uoe.getOption());
-        }
-    }
-
-    public void testValidate_MissingOption() {
-        final Group option = buildApacheCommandGroup();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        try {
-            option.validate(commandLine);
-            fail("Missing an option");
-        } catch (OptionException moe) {
-            assertEquals(option, moe.getOption());
-        }
-    }
-
-    public void testValidate_RequiredChild()
-        throws OptionException {
-        final Option required =
-            new 
DefaultOptionBuilder().withLongName("required").withRequired(true).create();
-        final Option optional =
-            new 
DefaultOptionBuilder().withLongName("optional").withRequired(false).create();
-        final Group group =
-            new 
GroupBuilder().withOption(required).withOption(optional).withMinimum(1).create();
-
-        WriteableCommandLine commandLine;
-
-        commandLine = commandLine(group, list());
-
-        try {
-            group.validate(commandLine);
-            fail("Missing option 'required'");
-        } catch (OptionException moe) {
-            assertEquals(required, moe.getOption());
-        }
-
-        commandLine = commandLine(group, list());
-        commandLine.addOption(optional);
-
-        try {
-            group.validate(commandLine);
-            fail("Missing option 'required'");
-        } catch (OptionException moe) {
-            assertEquals(required, moe.getOption());
-        }
-
-        commandLine = commandLine(group, list());
-        commandLine.addOption(required);
-        group.validate(commandLine);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testAppendUsage()
-     */
-    public void testAppendUsage() {
-        final Option option = buildApacheCommandGroup();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-
-        //settings.remove(DisplaySetting.DISPLAY_ARGUMENT_NUMBERED);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("httpd-cmds (graceful|restart|start|stop)", 
buffer.toString());
-    }
-
-    public void testAppendUsage_NoOptional() {
-        final Option option = buildApacheCommandGroup();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_OPTIONAL);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("httpd-cmds (graceful|restart|start|stop)", 
buffer.toString());
-    }
-
-    public void testAppendUsage_NoExpand() {
-        final Option option = buildApacheCommandGroup();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_EXPANDED);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("httpd-cmds", buffer.toString());
-    }
-
-    public void testAppendUsage_NoExpandOrName() {
-        final Option option = buildApacheCommandGroup();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_EXPANDED);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_NAME);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("httpd-cmds", buffer.toString());
-    }
-
-    public void testAppendUsage_NoName() {
-        final Option option = buildApacheCommandGroup();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_NAME);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("graceful|restart|start|stop", buffer.toString());
-    }
-
-    public void testAppendUsage_WithArgs() {
-        final Option option = buildAntGroup();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_OUTER);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("[ant (--help (-?,-h)) [<target1> [<target2> ...]]]", 
buffer.toString());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testGetPreferredName()
-     */
-    public void testGetPreferredName() {
-        final Option option = buildAntGroup();
-        assertEquals("ant", option.getPreferredName());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testGetDescription()
-     */
-    public void testGetDescription() {
-        final Option option = buildApachectlGroup();
-        assertEquals("Controls the apache http deamon", 
option.getDescription());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testHelpLines()
-     */
-    public void testHelpLines() {
-        final Option option = buildApacheCommandGroup();
-        final List lines = option.helpLines(0, DisplaySetting.ALL, null);
-        final Iterator i = lines.iterator();
-
-        final HelpLine line1 = (HelpLine) i.next();
-        assertEquals(0, line1.getIndent());
-        assertEquals(option, line1.getOption());
-
-        final HelpLine line2 = (HelpLine) i.next();
-        assertEquals(1, line2.getIndent());
-        assertEquals(COMMAND_GRACEFUL, line2.getOption());
-
-        final HelpLine line3 = (HelpLine) i.next();
-        assertEquals(1, line3.getIndent());
-        assertEquals(COMMAND_RESTART, line3.getOption());
-
-        final HelpLine line4 = (HelpLine) i.next();
-        assertEquals(1, line4.getIndent());
-        assertEquals(COMMAND_START, line4.getOption());
-
-        final HelpLine line5 = (HelpLine) i.next();
-        assertEquals(1, line5.getIndent());
-        assertEquals(COMMAND_STOP, line5.getOption());
-
-        assertFalse(i.hasNext());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testHelpLines()
-     */
-    public void testHelpLines_NoExpanded() {
-        final Option option = buildApacheCommandGroup();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_EXPANDED);
-
-        final List lines = option.helpLines(0, settings, null);
-        final Iterator i = lines.iterator();
-
-        final HelpLine line1 = (HelpLine) i.next();
-        assertEquals(0, line1.getIndent());
-        assertEquals(option, line1.getOption());
-
-        assertFalse(i.hasNext());
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.commons.cli2.OptionTestCase#testHelpLines()
-     */
-    public void testHelpLines_NoName() {
-        final Option option = buildApacheCommandGroup();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_NAME);
-
-        final List lines = option.helpLines(0, settings, null);
-        final Iterator i = lines.iterator();
-
-        final HelpLine line2 = (HelpLine) i.next();
-        assertEquals(1, line2.getIndent());
-        assertEquals(COMMAND_GRACEFUL, line2.getOption());
-
-        final HelpLine line3 = (HelpLine) i.next();
-        assertEquals(1, line3.getIndent());
-        assertEquals(COMMAND_RESTART, line3.getOption());
-
-        final HelpLine line4 = (HelpLine) i.next();
-        assertEquals(1, line4.getIndent());
-        assertEquals(COMMAND_START, line4.getOption());
-
-        final HelpLine line5 = (HelpLine) i.next();
-        assertEquals(1, line5.getIndent());
-        assertEquals(COMMAND_STOP, line5.getOption());
-
-        assertFalse(i.hasNext());
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/GroupTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/GroupTestCase.java 
b/src/test/org/apache/commons/cli2/option/GroupTestCase.java
deleted file mode 100644
index 5df178c..0000000
--- a/src/test/org/apache/commons/cli2/option/GroupTestCase.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import org.apache.commons.cli2.OptionException;
-
-/**
- * @author Rob Oxspring
- */
-public abstract class GroupTestCase
-    extends OptionTestCase {
-    public abstract void testProcessOptions()
-        throws OptionException;
-
-    public abstract void testProcessAnonymousArguments()
-        throws OptionException;
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/NestedGroupTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/NestedGroupTest.java 
b/src/test/org/apache/commons/cli2/option/NestedGroupTest.java
deleted file mode 100644
index ebebe2d..0000000
--- a/src/test/org/apache/commons/cli2/option/NestedGroupTest.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import org.apache.commons.cli2.CLITestCase;
-import org.apache.commons.cli2.CommandLine;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.builder.ArgumentBuilder;
-import org.apache.commons.cli2.builder.DefaultOptionBuilder;
-import org.apache.commons.cli2.builder.GroupBuilder;
-import org.apache.commons.cli2.commandline.Parser;
-import org.apache.commons.cli2.util.HelpFormatter;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * Test to exercise nested groups developed to demonstrate bug 32533
- */
-public class NestedGroupTest extends CLITestCase {
-    final static DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
-    final static ArgumentBuilder abuilder = new ArgumentBuilder();
-    final static GroupBuilder gbuilder = new GroupBuilder();
-
-    static Group buildActionGroup() {
-        return gbuilder.withName("Action").withDescription("Action")
-                       .withMinimum(1).withMaximum(1)
-                       .withOption(obuilder.withId(5).withShortName("e")
-                                           .withLongName("encrypt")
-                                           .withDescription("Encrypt input")
-                                           .create())
-                       .withOption(obuilder.withId(6).withShortName("d")
-                                           .withLongName("decrypt")
-                                           .withDescription("Decrypt input")
-                                           .create()).create();
-    }
-
-    static Group buildAlgorithmGroup() {
-        return gbuilder.withName("Algorithm")
-                       .withDescription("Encryption Algorithm").withMaximum(1)
-                       .withOption(obuilder.withId(0).withShortName("b")
-                                           .withLongName("blowfish")
-                                           
.withDescription("Blowfish").create())
-                       .withOption(obuilder.withId(1).withShortName("3")
-                                           .withLongName("3DES")
-                                           .withDescription("Triple DES")
-                                           .create()).create();
-    }
-
-    static Group buildInputGroup() {
-        return 
gbuilder.withName("Input").withDescription("Input").withMinimum(1)
-                       .withMaximum(1)
-                       .withOption(obuilder.withId(2).withShortName("f")
-                                           .withLongName("file")
-                                           .withDescription("Input file")
-                                           .withArgument(abuilder.withName(
-                    "file").withMinimum(1).withMaximum(1).create()).create())
-                       .withOption(obuilder.withId(3).withShortName("s")
-                                           .withLongName("string")
-                                           .withDescription("Input string")
-                                           .withArgument(abuilder.withName(
-                    "string").withMinimum(1).withMaximum(1).create()).create())
-                       .create();
-    }
-
-    static Group buildEncryptionServiceGroup(Group[] nestedGroups) {
-        gbuilder.withName("encryptionService")
-                .withOption(obuilder.withId(4).withShortName("h")
-                                    .withLongName("help")
-                                    .withDescription("Print this message")
-                                    
.create()).withOption(obuilder.withShortName(
-                "k").withLongName("key").withDescription("Encryption key")
-                                                                  .create());
-
-        for (int i = 0; i < nestedGroups.length; i++) {
-            gbuilder.withOption(nestedGroups[i]);
-        }
-
-        return gbuilder.create();
-    }
-
-    public void testNestedGroup()
-        throws OptionException {
-        final String[] args = {
-                "-eb",
-                "--file",
-                "/tmp/filename.txt"
-            };
-
-        Group[] nestedGroups = {
-                buildActionGroup(),
-                buildAlgorithmGroup(),
-                buildInputGroup()
-            };
-
-        Parser parser = new Parser();
-        parser.setGroup(buildEncryptionServiceGroup(nestedGroups));
-
-        CommandLine commandLine = parser.parse(args);
-
-        assertTrue("/tmp/filename.txt".equals(commandLine.getValue("-f")));
-        assertTrue(commandLine.hasOption("-e"));
-        assertTrue(commandLine.hasOption("-b"));
-        assertFalse(commandLine.hasOption("-d"));
-    }
-
-    public void testNestedGroupHelp() {
-        Group[] nestedGroups = {
-                buildActionGroup(),
-                buildAlgorithmGroup(),
-                buildInputGroup()
-            };
-
-        HelpFormatter helpFormatter = new HelpFormatter();
-        helpFormatter.setGroup(buildEncryptionServiceGroup(nestedGroups));
-
-        final StringWriter out = new StringWriter();
-        helpFormatter.setPrintWriter(new PrintWriter(out));
-
-        try {
-            helpFormatter.print();
-
-            final BufferedReader bufferedReader = new BufferedReader(new 
StringReader(
-                        out.toString()));
-            final String[] expected = new String[] {
-                    "Usage:                                                    
                      ",
-                    " [-h -k -e|-d -b|-3 -f <file>|-s <string>]                
                      ",
-                    "encryptionService                                         
                      ",
-                    "  -h (--help)               Print this message            
                      ",
-                    "  -k (--key)                Encryption key                
                      ",
-                    "  Action                    Action                        
                      ",
-                    "    -e (--encrypt)          Encrypt input                 
                      ",
-                    "    -d (--decrypt)          Decrypt input                 
                      ",
-                    "  Algorithm                 Encryption Algorithm          
                      ",
-                    "    -b (--blowfish)         Blowfish                      
                      ",
-                    "    -3 (--3DES)             Triple DES                    
                      ",
-                    "  Input                     Input                         
                      ",
-                    "    -f (--file) file        Input file                    
                      ",
-                    "    -s (--string) string    Input string                  
                      "
-                };
-
-            List actual = new ArrayList(expected.length);
-            String input;
-
-            while ((input = bufferedReader.readLine()) != null) {
-                actual.add(input);
-            }
-
-            // Show they are the same number of lines
-            assertEquals("Help text lines should be " + expected.length,
-                actual.size(), expected.length);
-
-            for (int i = 0; i < expected.length; i++) {
-                if (!expected[i].equals(actual.get(i))) {
-                    for (int x = 0; x < expected.length; i++) {
-                        System.out.println("   " + expected[i]);
-                        System.out.println((expected[i].equals(actual.get(i))
-                            ? "== "
-                            : "!= ") + actual.get(i));
-                    }
-                }
-
-                assertEquals(expected[i], actual.get(i));
-            }
-        }
-        catch (IOException e) {
-            fail(e.getLocalizedMessage());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/OptionTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/OptionTestCase.java 
b/src/test/org/apache/commons/cli2/option/OptionTestCase.java
deleted file mode 100644
index 55724b5..0000000
--- a/src/test/org/apache/commons/cli2/option/OptionTestCase.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import java.util.List;
-
-import org.apache.commons.cli2.CLITestCase;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.WriteableCommandLine;
-import org.apache.commons.cli2.commandline.WriteableCommandLineImpl;
-
-/**
- * @author Rob Oxspring
- */
-public abstract class OptionTestCase extends CLITestCase {
-
-    public static WriteableCommandLine commandLine(
-        final Option option,
-        final List args) {
-        return new WriteableCommandLineImpl(option, args);
-    }
-
-    public abstract void testTriggers();
-
-    public abstract void testPrefixes();
-
-    public abstract void testCanProcess();
-
-    public abstract void testProcess() throws OptionException;
-
-    public abstract void testValidate() throws OptionException;
-
-    public abstract void testAppendUsage() throws OptionException;
-
-    public abstract void testGetPreferredName();
-
-    public abstract void testGetDescription();
-
-    public abstract void testHelpLines();
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/test/org/apache/commons/cli2/option/ParentTest.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/commons/cli2/option/ParentTest.java 
b/src/test/org/apache/commons/cli2/option/ParentTest.java
deleted file mode 100644
index a25d9f1..0000000
--- a/src/test/org/apache/commons/cli2/option/ParentTest.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/**
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.option;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
-import org.apache.commons.cli2.Argument;
-import org.apache.commons.cli2.DisplaySetting;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.HelpLine;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.Parent;
-import org.apache.commons.cli2.WriteableCommandLine;
-import org.apache.commons.cli2.builder.ArgumentBuilder;
-import org.apache.commons.cli2.builder.CommandBuilder;
-import org.apache.commons.cli2.builder.DefaultOptionBuilder;
-import org.apache.commons.cli2.builder.GroupBuilder;
-import org.apache.commons.cli2.commandline.WriteableCommandLineImpl;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.resource.ResourceHelper;
-
-/**
- * @author Rob Oxspring
- */
-public class ParentTest
-    extends ParentTestCase {
-    public static final Argument COMPLEX_ARGUMENT =
-        new 
ArgumentBuilder().withName("username").withMinimum(1).withMaximum(1).create();
-    public static final Option COMPLEX_CHILD_SSL =
-        new 
DefaultOptionBuilder().withLongName("ssl").withShortName("s").create();
-    public static final Option COMPLEX_CHILD_BASIC =
-        new 
DefaultOptionBuilder().withLongName("basic").withShortName("b").create();
-    public static final Option COMPLEX_CHILD_DIGEST =
-        new 
DefaultOptionBuilder().withLongName("digest").withShortName("d").create();
-    public static final Group COMPLEX_CHILDREN =
-        new 
GroupBuilder().withName("login-opts").withOption(COMPLEX_CHILD_BASIC)
-                          
.withOption(COMPLEX_CHILD_DIGEST).withOption(COMPLEX_CHILD_SSL).create();
-
-    public static Parent buildLibParent() {
-        final Argument argument = ArgumentTest.buildPathArgument();
-
-        return new DefaultOption("-", "--", false, "--lib", "Specifies library 
search path", null,
-                                 null, false, argument, null, 'l');
-    }
-
-    public static Parent buildKParent() {
-        final Group children = GroupTest.buildApacheCommandGroup();
-
-        return new DefaultOption("-", "--", false, "-k", "desc", null, null, 
false, null, children,
-                                 'k');
-    }
-
-    public static Parent buildComplexParent() {
-        return new 
CommandBuilder().withName("login").withName("lo").withName("l")
-                                   
.withArgument(COMPLEX_ARGUMENT).withChildren(COMPLEX_CHILDREN)
-                                   .create();
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.ParentTestCase#testProcessParent()
-     */
-    public void testProcessParent()
-        throws OptionException {
-        final Parent option = buildKParent();
-        final List args = list("-k", "start");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.processParent(commandLine, iterator);
-
-        assertEquals("start", iterator.next());
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("-k"));
-        assertTrue(commandLine.getValues(option).isEmpty());
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testCanProcess()
-     */
-    public void testCanProcess() {
-        final Parent option = buildKParent();
-        assertTrue(option.canProcess(new WriteableCommandLineImpl(option, 
null), "-k"));
-    }
-
-    public void testCanProcess_BadMatch() {
-        final Parent option = buildKParent();
-        assertFalse(option.canProcess(new WriteableCommandLineImpl(option, 
null), "-K"));
-    }
-
-    public void testCanProcess_ContractedArgument() {
-        final Parent option = buildLibParent();
-        assertTrue(option.canProcess(new WriteableCommandLineImpl(option, 
null), "--lib=/usr/lib"));
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testPrefixes()
-     */
-    public void testPrefixes() {
-        final Parent option = buildKParent();
-        assertContentsEqual(list("-", "--"), option.getPrefixes());
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testProcess()
-     */
-    public void testProcess()
-        throws OptionException {
-        final Parent option = CommandTest.buildStartCommand();
-        final List args = list("start");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.process(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("start"));
-        assertFalse(commandLine.hasOption("stop"));
-        assertTrue(commandLine.getValues(option).isEmpty());
-    }
-
-    public void testProcess_NoMatch()
-        throws OptionException {
-        final Parent option = CommandTest.buildStartCommand();
-        final List args = list("whatever");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-
-        try {
-            option.process(commandLine, iterator);
-            fail("unexpected token not thrown");
-        } catch (OptionException exp) {
-            OptionException e =
-                new OptionException(option, 
ResourceConstants.UNEXPECTED_TOKEN, "whatever");
-            assertEquals("wrong exception message", e.getMessage(), 
exp.getMessage());
-        }
-    }
-
-    public void testProcess_Children()
-        throws OptionException {
-        final Parent option = buildKParent();
-        final List args = list("-k", "start");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.process(commandLine, iterator);
-
-        assertNull(option.findOption("whatever"));
-        assertNotNull(option.findOption("start"));
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("-k"));
-        assertTrue(commandLine.hasOption("start"));
-        assertFalse(commandLine.hasOption("stop"));
-        assertTrue(commandLine.getValues(option).isEmpty());
-    }
-
-    public void testProcess_Argument()
-        throws OptionException {
-        final Parent option = buildLibParent();
-        final List args = list("--lib=C:\\WINDOWS;C:\\WINNT;C:\\");
-        final WriteableCommandLine commandLine = commandLine(option, args);
-        final ListIterator iterator = args.listIterator();
-        option.process(commandLine, iterator);
-
-        assertFalse(iterator.hasNext());
-        assertTrue(commandLine.hasOption(option));
-        assertTrue(commandLine.hasOption("--lib"));
-        assertContentsEqual(list("C:\\WINDOWS", "C:\\WINNT", "C:\\"), 
commandLine.getValues(option));
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testTriggers()
-     */
-    public void testTriggers() {
-        final Parent option = buildKParent();
-        assertContentsEqual(list("-k"), option.getTriggers());
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testValidate()
-     */
-    public void testValidate()
-        throws OptionException {
-        final Parent option = CommandTest.buildStartCommand();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        option.validate(commandLine);
-
-        commandLine.addOption(option);
-
-        option.validate(commandLine);
-    }
-
-    public void testValidate_Children()
-        throws OptionException {
-        final Parent option = buildKParent();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        option.validate(commandLine);
-        commandLine.addOption(option);
-
-        try {
-            option.validate(commandLine);
-            fail("Missing a command");
-        } catch (OptionException moe) {
-            assertNotNull(moe.getOption());
-            assertNotSame(option, moe.getOption());
-        }
-    }
-
-    public void testValidate_Argument()
-        throws OptionException {
-        final Command option = CommandTest.buildLoginCommand();
-        final WriteableCommandLine commandLine = commandLine(option, list());
-
-        option.validate(commandLine);
-
-        commandLine.addOption(option);
-
-        try {
-            option.validate(commandLine);
-            fail("Missing a value");
-        } catch (OptionException moe) {
-            assertSame(option, moe.getOption());
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testAppendUsage()
-     */
-    public void testAppendUsage() {
-        final Option option = buildComplexParent();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_OUTER);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("[login (l,lo) <username> [login-opts (--basic 
(-b)|--digest (-d)|--ssl (-s))]]",
-                     buffer.toString());
-    }
-
-    public void testAppendUsage_NoArguments() {
-        final Option option = buildComplexParent();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_PARENT_ARGUMENT);
-        settings.remove(DisplaySetting.DISPLAY_GROUP_OUTER);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("[login (l,lo) [login-opts (--basic (-b)|--digest 
(-d)|--ssl (-s))]]",
-                     buffer.toString());
-    }
-
-    public void testAppendUsage_NoChildren() {
-        final Option option = buildComplexParent();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_PARENT_CHILDREN);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("[login (l,lo) <username>]", buffer.toString());
-    }
-
-    public void testAppendUsage_NoArgumentsOrChildren() {
-        final Option option = buildComplexParent();
-        final StringBuffer buffer = new StringBuffer();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_PARENT_CHILDREN);
-        settings.remove(DisplaySetting.DISPLAY_PARENT_ARGUMENT);
-        option.appendUsage(buffer, settings, null);
-
-        assertEquals("[login (l,lo)]", buffer.toString());
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testGetPreferredName()
-     */
-    public void testGetPreferredName() {
-        final Option option = buildLibParent();
-        assertEquals("--lib", option.getPreferredName());
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testGetDescription()
-     */
-    public void testGetDescription() {
-        final Option option = buildLibParent();
-        assertEquals("Specifies library search path", option.getDescription());
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.commons.cli2.OptionTestCase#testHelpLines()
-     */
-    public void testHelpLines() {
-        final Option option = buildComplexParent();
-        final List lines = option.helpLines(0, DisplaySetting.ALL, null);
-        final Iterator i = lines.iterator();
-
-        final HelpLine line1 = (HelpLine) i.next();
-        assertEquals(0, line1.getIndent());
-        assertEquals(option, line1.getOption());
-
-        final HelpLine line2 = (HelpLine) i.next();
-        assertEquals(1, line2.getIndent());
-        assertEquals(COMPLEX_ARGUMENT, line2.getOption());
-
-        final HelpLine line3 = (HelpLine) i.next();
-        assertEquals(1, line3.getIndent());
-        assertEquals(COMPLEX_CHILDREN, line3.getOption());
-
-        final HelpLine line4 = (HelpLine) i.next();
-        assertEquals(2, line4.getIndent());
-        assertEquals(COMPLEX_CHILD_BASIC, line4.getOption());
-
-        final HelpLine line5 = (HelpLine) i.next();
-        assertEquals(2, line5.getIndent());
-        assertEquals(COMPLEX_CHILD_DIGEST, line5.getOption());
-
-        final HelpLine line6 = (HelpLine) i.next();
-        assertEquals(2, line6.getIndent());
-        assertEquals(COMPLEX_CHILD_SSL, line6.getOption());
-
-        assertFalse(i.hasNext());
-    }
-
-    public void testHelpLines_NoArgument() {
-        final Option option = buildComplexParent();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_PARENT_ARGUMENT);
-
-        final List lines = option.helpLines(0, settings, null);
-        final Iterator i = lines.iterator();
-
-        final HelpLine line1 = (HelpLine) i.next();
-        assertEquals(0, line1.getIndent());
-        assertEquals(option, line1.getOption());
-
-        final HelpLine line3 = (HelpLine) i.next();
-        assertEquals(1, line3.getIndent());
-        assertEquals(COMPLEX_CHILDREN, line3.getOption());
-
-        final HelpLine line4 = (HelpLine) i.next();
-        assertEquals(2, line4.getIndent());
-        assertEquals(COMPLEX_CHILD_BASIC, line4.getOption());
-
-        final HelpLine line5 = (HelpLine) i.next();
-        assertEquals(2, line5.getIndent());
-        assertEquals(COMPLEX_CHILD_DIGEST, line5.getOption());
-
-        final HelpLine line6 = (HelpLine) i.next();
-        assertEquals(2, line6.getIndent());
-        assertEquals(COMPLEX_CHILD_SSL, line6.getOption());
-
-        assertFalse(i.hasNext());
-    }
-
-    public void testHelpLines_NoChildren() {
-        final Option option = buildComplexParent();
-        final Set settings = new HashSet(DisplaySetting.ALL);
-        settings.remove(DisplaySetting.DISPLAY_PARENT_CHILDREN);
-
-        final List lines = option.helpLines(0, settings, null);
-        final Iterator i = lines.iterator();
-
-        final HelpLine line1 = (HelpLine) i.next();
-        assertEquals(0, line1.getIndent());
-        assertEquals(option, line1.getOption());
-
-        final HelpLine line2 = (HelpLine) i.next();
-        assertEquals(1, line2.getIndent());
-        assertEquals(COMPLEX_ARGUMENT, line2.getOption());
-
-        assertFalse(i.hasNext());
-    }
-
-    public void testNullPreferredName() {
-        try {
-               new CommandBuilder().create();
-        } catch (IllegalStateException exp) {
-               
assertEquals(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.OPTION_NO_NAME),
 exp.getMessage());
-        }
-    }
-
-    public void testRequired() {
-       Command cmd = new 
CommandBuilder().withRequired(true).withName("blah").create();
-       assertTrue("cmd is not required", cmd.isRequired());
-       assertEquals("id is incorrect", 0, cmd.getId());
-    }
-
-    public void testID() {
-       Command cmd = new 
CommandBuilder().withId('c').withName("blah").create();
-       assertEquals("id is incorrect", 'c', cmd.getId());
-    }
-
-    public void testGetId() {
-        assertEquals('h', DefaultOptionTest.buildHelpOption().getId());
-        assertEquals('X', DefaultOptionTest.buildXOption().getId());
-        assertEquals(0, CommandTest.buildStartCommand().getId());
-    }
-}

Reply via email to