Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionBuilderTest.java Mon Jun 5 16:37:32 2017 @@ -29,7 +29,7 @@ public class OptionBuilderTest { @Test public void testCompleteOption( ) { - Option simple = OptionBuilder.withLongOpt( "simple option") + final Option simple = OptionBuilder.withLongOpt( "simple option") .hasArg( ) .isRequired( ) .hasArgs( ) @@ -80,7 +80,7 @@ public class OptionBuilderTest @Test public void testBaseOptionCharOpt() { - Option base = OptionBuilder.withDescription( "option description") + final Option base = OptionBuilder.withDescription( "option description") .create( 'o' ); assertEquals( "o", base.getOpt() ); @@ -90,7 +90,7 @@ public class OptionBuilderTest @Test public void testBaseOptionStringOpt() { - Option base = OptionBuilder.withDescription( "option description") + final Option base = OptionBuilder.withDescription( "option description") .create( "o" ); assertEquals( "o", base.getOpt() ); @@ -102,18 +102,18 @@ public class OptionBuilderTest public void testSpecialOptChars() throws Exception { // '?' - Option opt1 = OptionBuilder.withDescription("help options").create('?'); + final Option opt1 = OptionBuilder.withDescription("help options").create('?'); assertEquals("?", opt1.getOpt()); // '@' - Option opt2 = OptionBuilder.withDescription("read from stdin").create('@'); + final Option opt2 = OptionBuilder.withDescription("read from stdin").create('@'); assertEquals("@", opt2.getOpt()); // ' ' try { OptionBuilder.create(' '); fail( "IllegalArgumentException not caught" ); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { // success } } @@ -121,7 +121,7 @@ public class OptionBuilderTest @Test public void testOptionArgNumbers() { - Option opt = OptionBuilder.withDescription( "option description" ) + final Option opt = OptionBuilder.withDescription( "option description" ) .hasArgs( 2 ) .create( 'o' ); assertEquals( 2, opt.getArgs() ); @@ -134,7 +134,7 @@ public class OptionBuilderTest OptionBuilder.withDescription( "option description" ).create( '"' ); fail( "IllegalArgumentException not caught" ); } - catch( IllegalArgumentException exp ) { + catch( final IllegalArgumentException exp ) { // success } @@ -143,7 +143,7 @@ public class OptionBuilderTest OptionBuilder.create( "opt`" ); fail( "IllegalArgumentException not caught" ); } - catch( IllegalArgumentException exp ) { + catch( final IllegalArgumentException exp ) { // success } @@ -152,7 +152,7 @@ public class OptionBuilderTest OptionBuilder.create( "opt" ); // success } - catch( IllegalArgumentException exp ) { + catch( final IllegalArgumentException exp ) { fail( "IllegalArgumentException caught" ); } } @@ -164,7 +164,7 @@ public class OptionBuilderTest OptionBuilder.hasArg().create(); fail("Incomplete option should be rejected"); } - catch (IllegalArgumentException e) + catch (final IllegalArgumentException e) { // expected @@ -180,7 +180,7 @@ public class OptionBuilderTest OptionBuilder.withDescription("JUnit").create('"'); fail("IllegalArgumentException expected"); } - catch (IllegalArgumentException e) + catch (final IllegalArgumentException e) { // expected } @@ -191,7 +191,7 @@ public class OptionBuilderTest OptionBuilder.withDescription("JUnit").create(); fail("IllegalArgumentException expected"); } - catch (IllegalArgumentException e) + catch (final IllegalArgumentException e) { // expected }
Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionGroupTest.java Mon Jun 5 16:37:32 2017 @@ -36,24 +36,24 @@ public class OptionGroupTest @Before public void setUp() { - Option file = new Option( "f", "file", false, "file to process" ); - Option dir = new Option( "d", "directory", false, "directory to process" ); - OptionGroup group = new OptionGroup(); + final Option file = new Option( "f", "file", false, "file to process" ); + final Option dir = new Option( "d", "directory", false, "directory to process" ); + final OptionGroup group = new OptionGroup(); group.addOption( file ); group.addOption( dir ); _options = new Options().addOptionGroup( group ); - Option section = new Option( "s", "section", false, "section to process" ); - Option chapter = new Option( "c", "chapter", false, "chapter to process" ); - OptionGroup group2 = new OptionGroup(); + final Option section = new Option( "s", "section", false, "section to process" ); + final Option chapter = new Option( "c", "chapter", false, "chapter to process" ); + final OptionGroup group2 = new OptionGroup(); group2.addOption( section ); group2.addOption( chapter ); _options.addOptionGroup( group2 ); - Option importOpt = new Option( null, "import", false, "section to process" ); - Option exportOpt = new Option( null, "export", false, "chapter to process" ); - OptionGroup group3 = new OptionGroup(); + final Option importOpt = new Option( null, "import", false, "section to process" ); + final Option exportOpt = new Option( null, "export", false, "chapter to process" ); + final OptionGroup group3 = new OptionGroup(); group3.addOption( importOpt ); group3.addOption( exportOpt ); _options.addOptionGroup( group3 ); @@ -64,9 +64,9 @@ public class OptionGroupTest @Test public void testSingleOptionFromGroup() throws Exception { - String[] args = new String[] { "-f" }; + final String[] args = new String[] { "-f" }; - CommandLine cl = parser.parse( _options, args); + final CommandLine cl = parser.parse( _options, args); assertTrue( "Confirm -r is NOT set", !cl.hasOption("r") ); assertTrue( "Confirm -f is set", cl.hasOption("f") ); @@ -79,9 +79,9 @@ public class OptionGroupTest @Test public void testSingleOption() throws Exception { - String[] args = new String[] { "-r" }; + final String[] args = new String[] { "-r" }; - CommandLine cl = parser.parse( _options, args); + final CommandLine cl = parser.parse( _options, args); assertTrue( "Confirm -r is set", cl.hasOption("r") ); assertTrue( "Confirm -f is NOT set", !cl.hasOption("f") ); @@ -94,9 +94,9 @@ public class OptionGroupTest @Test public void testTwoValidOptions() throws Exception { - String[] args = new String[] { "-r", "-f" }; + final String[] args = new String[] { "-r", "-f" }; - CommandLine cl = parser.parse( _options, args); + final CommandLine cl = parser.parse( _options, args); assertTrue( "Confirm -r is set", cl.hasOption("r") ); assertTrue( "Confirm -f is set", cl.hasOption("f") ); @@ -109,9 +109,9 @@ public class OptionGroupTest @Test public void testSingleLongOption() throws Exception { - String[] args = new String[] { "--file" }; + final String[] args = new String[] { "--file" }; - CommandLine cl = parser.parse( _options, args); + final CommandLine cl = parser.parse( _options, args); assertTrue( "Confirm -r is NOT set", !cl.hasOption("r") ); assertTrue( "Confirm -f is set", cl.hasOption("f") ); @@ -124,9 +124,9 @@ public class OptionGroupTest @Test public void testTwoValidLongOptions() throws Exception { - String[] args = new String[] { "--revision", "--file" }; + final String[] args = new String[] { "--revision", "--file" }; - CommandLine cl = parser.parse( _options, args); + final CommandLine cl = parser.parse( _options, args); assertTrue( "Confirm -r is set", cl.hasOption("r") ); assertTrue( "Confirm -f is set", cl.hasOption("f") ); @@ -139,9 +139,9 @@ public class OptionGroupTest @Test public void testNoOptionsExtraArgs() throws Exception { - String[] args = new String[] { "arg1", "arg2" }; + final String[] args = new String[] { "arg1", "arg2" }; - CommandLine cl = parser.parse( _options, args); + final CommandLine cl = parser.parse( _options, args); assertTrue( "Confirm -r is NOT set", !cl.hasOption("r") ); assertTrue( "Confirm -f is NOT set", !cl.hasOption("f") ); @@ -154,14 +154,14 @@ public class OptionGroupTest @Test public void testTwoOptionsFromGroup() throws Exception { - String[] args = new String[] { "-f", "-d" }; + final String[] args = new String[] { "-f", "-d" }; try { parser.parse( _options, args); fail( "two arguments from group not allowed" ); } - catch (AlreadySelectedException e) + catch (final AlreadySelectedException e) { assertNotNull("null option group", e.getOptionGroup()); assertEquals("selected option", "f", e.getOptionGroup().getSelected()); @@ -172,14 +172,14 @@ public class OptionGroupTest @Test public void testTwoLongOptionsFromGroup() throws Exception { - String[] args = new String[] { "--file", "--directory" }; + final String[] args = new String[] { "--file", "--directory" }; try { parser.parse(_options, args); fail( "two arguments from group not allowed" ); } - catch (AlreadySelectedException e) + catch (final AlreadySelectedException e) { assertNotNull("null option group", e.getOptionGroup()); assertEquals("selected option", "f", e.getOptionGroup().getSelected()); @@ -190,9 +190,9 @@ public class OptionGroupTest @Test public void testTwoOptionsFromDifferentGroup() throws Exception { - String[] args = new String[] { "-f", "-s" }; + final String[] args = new String[] { "-f", "-s" }; - CommandLine cl = parser.parse( _options, args); + final CommandLine cl = parser.parse( _options, args); assertTrue( "Confirm -r is NOT set", !cl.hasOption("r") ); assertTrue( "Confirm -f is set", cl.hasOption("f") ); assertTrue( "Confirm -d is NOT set", !cl.hasOption("d") ); @@ -204,12 +204,12 @@ public class OptionGroupTest @Test public void testTwoOptionsFromGroupWithProperties() throws Exception { - String[] args = new String[] { "-f" }; + final String[] args = new String[] { "-f" }; - Properties properties = new Properties(); + final Properties properties = new Properties(); properties.put("d", "true"); - CommandLine cl = parser.parse( _options, args, properties); + final CommandLine cl = parser.parse( _options, args, properties); assertTrue(cl.hasOption("f")); assertTrue(!cl.hasOption("d")); } @@ -217,17 +217,17 @@ public class OptionGroupTest @Test public void testValidLongOnlyOptions() throws Exception { - CommandLine cl1 = parser.parse(_options, new String[]{"--export"}); + final CommandLine cl1 = parser.parse(_options, new String[]{"--export"}); assertTrue("Confirm --export is set", cl1.hasOption("export")); - CommandLine cl2 = parser.parse(_options, new String[]{"--import"}); + final CommandLine cl2 = parser.parse(_options, new String[]{"--import"}); assertTrue("Confirm --import is set", cl2.hasOption("import")); } @Test public void testToString() { - OptionGroup group1 = new OptionGroup(); + final OptionGroup group1 = new OptionGroup(); group1.addOption(new Option(null, "foo", false, "Foo")); group1.addOption(new Option(null, "bar", false, "Bar")); @@ -235,7 +235,7 @@ public class OptionGroupTest assertEquals("[--foo Foo, --bar Bar]", group1.toString()); } - OptionGroup group2 = new OptionGroup(); + final OptionGroup group2 = new OptionGroup(); group2.addOption(new Option("f", "foo", false, "Foo")); group2.addOption(new Option("b", "bar", false, "Bar")); @@ -247,7 +247,7 @@ public class OptionGroupTest @Test public void testGetNames() { - OptionGroup group = new OptionGroup(); + final OptionGroup group = new OptionGroup(); group.addOption(OptionBuilder.create('a')); group.addOption(OptionBuilder.create('b')); Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionTest.java Mon Jun 5 16:37:32 2017 @@ -47,7 +47,7 @@ public class OptionTest @Test public void testClear() { - TestOption option = new TestOption("x", true, ""); + final TestOption option = new TestOption("x", true, ""); assertEquals(0, option.getValuesList().size()); option.addValue("a"); assertEquals(1, option.getValuesList().size()); @@ -59,8 +59,8 @@ public class OptionTest @Test public void testClone() { - TestOption a = new TestOption("a", true, ""); - TestOption b = (TestOption) a.clone(); + final TestOption a = new TestOption("a", true, ""); + final TestOption b = (TestOption) a.clone(); assertEquals(a, b); assertNotSame(a, b); a.setDescription("a"); @@ -102,8 +102,8 @@ public class OptionTest @Test public void testSubclass() { - Option option = new DefaultOption("f", "file", "myfile.txt"); - Option clone = (Option) option.clone(); + final Option option = new DefaultOption("f", "file", "myfile.txt"); + final Option clone = (Option) option.clone(); assertEquals("myfile.txt", clone.getValue()); assertEquals(DefaultOption.class, clone.getClass()); } @@ -111,7 +111,7 @@ public class OptionTest @Test public void testHasArgName() { - Option option = new Option("f", null); + final Option option = new Option("f", null); option.setArgName(null); assertFalse(option.hasArgName()); @@ -126,7 +126,7 @@ public class OptionTest @Test public void testHasArgs() { - Option option = new Option("f", null); + final Option option = new Option("f", null); option.setArgs(0); assertFalse(option.hasArgs()); @@ -147,7 +147,7 @@ public class OptionTest @Test public void testGetValue() { - Option option = new Option("f", null); + final Option option = new Option("f", null); option.setArgs(Option.UNLIMITED_VALUES); assertEquals("default", option.getValue("default")); @@ -163,7 +163,7 @@ public class OptionTest @Test public void testBuilderMethods() { - char defaultSeparator = (char) 0; + final char defaultSeparator = (char) 0; checkOption(Option.builder("a").desc("desc").build(), "a", "desc", null, Option.UNINITIALIZED, null, false, false, defaultSeparator, String.class); Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/OptionsTest.java Mon Jun 5 16:37:32 2017 @@ -33,7 +33,7 @@ public class OptionsTest @Test public void testSimple() { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption("a", false, "toggle -a"); opts.addOption("b", true, "toggle -b"); @@ -45,7 +45,7 @@ public class OptionsTest @Test public void testDuplicateSimple() { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption("a", false, "toggle -a"); opts.addOption("a", true, "toggle -a*"); @@ -55,7 +55,7 @@ public class OptionsTest @Test public void testLong() { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption("a", "--a", false, "toggle -a"); opts.addOption("b", "--b", true, "set -b"); @@ -67,7 +67,7 @@ public class OptionsTest @Test public void testDuplicateLong() { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption("a", "--a", false, "toggle -a"); opts.addOption("a", "--a", false, "toggle -a*"); assertEquals("last one in wins", "toggle -a*", opts.getOption("a").getDescription()); @@ -76,14 +76,14 @@ public class OptionsTest @Test public void testHelpOptions() { - Option longOnly1 = OptionBuilder.withLongOpt("long-only1").create(); - Option longOnly2 = OptionBuilder.withLongOpt("long-only2").create(); - Option shortOnly1 = OptionBuilder.create("1"); - Option shortOnly2 = OptionBuilder.create("2"); - Option bothA = OptionBuilder.withLongOpt("bothA").create("a"); - Option bothB = OptionBuilder.withLongOpt("bothB").create("b"); + final Option longOnly1 = OptionBuilder.withLongOpt("long-only1").create(); + final Option longOnly2 = OptionBuilder.withLongOpt("long-only2").create(); + final Option shortOnly1 = OptionBuilder.create("1"); + final Option shortOnly2 = OptionBuilder.create("2"); + final Option bothA = OptionBuilder.withLongOpt("bothA").create("a"); + final Option bothB = OptionBuilder.withLongOpt("bothB").create("b"); - Options options = new Options(); + final Options options = new Options(); options.addOption(longOnly1); options.addOption(longOnly2); options.addOption(shortOnly1); @@ -91,7 +91,7 @@ public class OptionsTest options.addOption(bothA); options.addOption(bothB); - Collection<Option> allOptions = new ArrayList<Option>(); + final Collection<Option> allOptions = new ArrayList<Option>(); allOptions.add(longOnly1); allOptions.add(longOnly2); allOptions.add(shortOnly1); @@ -99,7 +99,7 @@ public class OptionsTest allOptions.add(bothA); allOptions.add(bothB); - Collection<Option> helpOptions = options.helpOptions(); + final Collection<Option> helpOptions = options.helpOptions(); assertTrue("Everything in all should be in help", helpOptions.containsAll(allOptions)); assertTrue("Everything in help should be in all", allOptions.containsAll(helpOptions)); @@ -108,14 +108,14 @@ public class OptionsTest @Test public void testMissingOptionException() throws ParseException { - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.isRequired().create("f")); try { new PosixParser().parse(options, new String[0]); fail("Expected MissingOptionException to be thrown"); } - catch (MissingOptionException e) + catch (final MissingOptionException e) { assertEquals("Missing required option: f", e.getMessage()); } @@ -124,7 +124,7 @@ public class OptionsTest @Test public void testMissingOptionsException() throws ParseException { - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.isRequired().create("f")); options.addOption(OptionBuilder.isRequired().create("x")); try @@ -132,7 +132,7 @@ public class OptionsTest new PosixParser().parse(options, new String[0]); fail("Expected MissingOptionException to be thrown"); } - catch (MissingOptionException e) + catch (final MissingOptionException e) { assertEquals("Missing required options: f, x", e.getMessage()); } @@ -141,11 +141,11 @@ public class OptionsTest @Test public void testToString() { - Options options = new Options(); + final Options options = new Options(); options.addOption("f", "foo", true, "Foo"); options.addOption("b", "bar", false, "Bar"); - String s = options.toString(); + final String s = options.toString(); assertNotNull("null string returned", s); assertTrue("foo option missing", s.toLowerCase().contains("foo")); assertTrue("bar option missing", s.toLowerCase().contains("bar")); @@ -154,13 +154,13 @@ public class OptionsTest @Test public void testGetOptionsGroups() { - Options options = new Options(); + final Options options = new Options(); - OptionGroup group1 = new OptionGroup(); + final OptionGroup group1 = new OptionGroup(); group1.addOption(OptionBuilder.create('a')); group1.addOption(OptionBuilder.create('b')); - OptionGroup group2 = new OptionGroup(); + final OptionGroup group2 = new OptionGroup(); group2.addOption(OptionBuilder.create('x')); group2.addOption(OptionBuilder.create('y')); @@ -174,7 +174,7 @@ public class OptionsTest @Test public void testGetMatchingOpts() { - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("version").create()); options.addOption(OptionBuilder.withLongOpt("verbose").create()); Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ParserTestCase.java Mon Jun 5 16:37:32 2017 @@ -51,11 +51,11 @@ public abstract class ParserTestCase @Test public void testSimpleShort() throws Exception { - String[] args = new String[] { "-a", + final String[] args = new String[] { "-a", "-b", "toast", "foo", "bar" }; - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm -a is set", cl.hasOption("a")); assertTrue("Confirm -b is set", cl.hasOption("b")); @@ -66,11 +66,11 @@ public abstract class ParserTestCase @Test public void testSimpleLong() throws Exception { - String[] args = new String[] { "--enable-a", + final String[] args = new String[] { "--enable-a", "--bfile", "toast", "foo", "bar" }; - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue( "Confirm -a is set", cl.hasOption("a") ); assertTrue( "Confirm -b is set", cl.hasOption("b") ); @@ -82,7 +82,7 @@ public abstract class ParserTestCase @Test public void testMultiple() throws Exception { - String[] args = new String[] { "-c", + final String[] args = new String[] { "-c", "foobar", "-b", "toast" }; @@ -102,7 +102,7 @@ public abstract class ParserTestCase @Test public void testMultipleWithLong() throws Exception { - String[] args = new String[] { "--copt", + final String[] args = new String[] { "--copt", "foobar", "--bfile", "toast" }; @@ -122,14 +122,14 @@ public abstract class ParserTestCase @Test public void testUnrecognizedOption() throws Exception { - String[] args = new String[] { "-a", "-d", "-b", "toast", "foo", "bar" }; + final String[] args = new String[] { "-a", "-d", "-b", "toast", "foo", "bar" }; try { parser.parse(options, args); fail("UnrecognizedOptionException wasn't thrown"); } - catch (UnrecognizedOptionException e) + catch (final UnrecognizedOptionException e) { assertEquals("-d", e.getOption()); } @@ -138,7 +138,7 @@ public abstract class ParserTestCase @Test public void testMissingArg() throws Exception { - String[] args = new String[] { "-b" }; + final String[] args = new String[] { "-b" }; boolean caught = false; @@ -146,7 +146,7 @@ public abstract class ParserTestCase { parser.parse(options, args); } - catch (MissingArgumentException e) + catch (final MissingArgumentException e) { caught = true; assertEquals("option missing an argument", "b", e.getOption().getOpt()); @@ -158,11 +158,11 @@ public abstract class ParserTestCase @Test public void testDoubleDash1() throws Exception { - String[] args = new String[] { "--copt", + final String[] args = new String[] { "--copt", "--", "-b", "toast" }; - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm -c is set", cl.hasOption("c")); assertTrue("Confirm -b is not set", !cl.hasOption("b")); @@ -172,7 +172,7 @@ public abstract class ParserTestCase @Test public void testDoubleDash2() throws Exception { - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.hasArg().create('n')); options.addOption(OptionBuilder.create('m')); @@ -181,7 +181,7 @@ public abstract class ParserTestCase parser.parse(options, new String[]{"-n", "--", "-m"}); fail("MissingArgumentException not thrown for option -n"); } - catch (MissingArgumentException e) + catch (final MissingArgumentException e) { assertNotNull("option null", e.getOption()); assertEquals("n", e.getOption().getOpt()); @@ -191,12 +191,12 @@ public abstract class ParserTestCase @Test public void testSingleDash() throws Exception { - String[] args = new String[] { "--copt", + final String[] args = new String[] { "--copt", "-b", "-", "-a", "-" }; - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm -a is set", cl.hasOption("a")); assertTrue("Confirm -b is set", cl.hasOption("b")); @@ -208,12 +208,12 @@ public abstract class ParserTestCase @Test public void testStopAtUnexpectedArg() throws Exception { - String[] args = new String[] { "-c", + final String[] args = new String[] { "-c", "foober", "-b", "toast" }; - CommandLine cl = parser.parse(options, args, true); + final CommandLine cl = parser.parse(options, args, true); assertTrue("Confirm -c is set", cl.hasOption("c")); assertTrue("Confirm 3 extra args: " + cl.getArgList().size(), cl.getArgList().size() == 3); } @@ -221,9 +221,9 @@ public abstract class ParserTestCase @Test public void testStopAtExpectedArg() throws Exception { - String[] args = new String[]{"-b", "foo"}; + final String[] args = new String[]{"-b", "foo"}; - CommandLine cl = parser.parse(options, args, true); + final CommandLine cl = parser.parse(options, args, true); assertTrue("Confirm -b is set", cl.hasOption('b')); assertEquals("Confirm -b is set", "foo", cl.getOptionValue('b')); @@ -233,11 +233,11 @@ public abstract class ParserTestCase @Test public void testStopAtNonOptionShort() throws Exception { - String[] args = new String[]{"-z", + final String[] args = new String[]{"-z", "-a", "-btoast"}; - CommandLine cl = parser.parse(options, args, true); + final CommandLine cl = parser.parse(options, args, true); assertFalse("Confirm -a is not set", cl.hasOption("a")); assertTrue("Confirm 3 extra args: " + cl.getArgList().size(), cl.getArgList().size() == 3); } @@ -245,11 +245,11 @@ public abstract class ParserTestCase @Test public void testStopAtNonOptionLong() throws Exception { - String[] args = new String[]{"--zop==1", + final String[] args = new String[]{"--zop==1", "-abtoast", "--b=bar"}; - CommandLine cl = parser.parse(options, args, true); + final CommandLine cl = parser.parse(options, args, true); assertFalse("Confirm -a is not set", cl.hasOption("a")); assertFalse("Confirm -b is not set", cl.hasOption("b")); @@ -259,41 +259,41 @@ public abstract class ParserTestCase @Test public void testNegativeArgument() throws Exception { - String[] args = new String[] { "-b", "-1"} ; + final String[] args = new String[] { "-b", "-1"} ; - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertEquals("-1", cl.getOptionValue("b")); } @Test public void testNegativeOption() throws Exception { - String[] args = new String[] { "-b", "-1"} ; + final String[] args = new String[] { "-b", "-1"} ; options.addOption("1", false, null); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertEquals("-1", cl.getOptionValue("b")); } @Test public void testArgumentStartingWithHyphen() throws Exception { - String[] args = new String[]{"-b", "-foo"}; + final String[] args = new String[]{"-b", "-foo"}; - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertEquals("-foo", cl.getOptionValue("b")); } @Test public void testShortWithEqual() throws Exception { - String[] args = new String[] { "-f=bar" }; + final String[] args = new String[] { "-f=bar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").hasArg().create('f')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertEquals("bar", cl.getOptionValue("foo")); } @@ -301,12 +301,12 @@ public abstract class ParserTestCase @Test public void testShortWithoutEqual() throws Exception { - String[] args = new String[] { "-fbar" }; + final String[] args = new String[] { "-fbar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").hasArg().create('f')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertEquals("bar", cl.getOptionValue("foo")); } @@ -314,12 +314,12 @@ public abstract class ParserTestCase @Test public void testLongWithEqualDoubleDash() throws Exception { - String[] args = new String[] { "--foo=bar" }; + final String[] args = new String[] { "--foo=bar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").hasArg().create('f')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertEquals("bar", cl.getOptionValue("foo")); } @@ -327,12 +327,12 @@ public abstract class ParserTestCase @Test public void testLongWithEqualSingleDash() throws Exception { - String[] args = new String[] { "-foo=bar" }; + final String[] args = new String[] { "-foo=bar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").hasArg().create('f')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertEquals("bar", cl.getOptionValue("foo")); } @@ -340,12 +340,12 @@ public abstract class ParserTestCase @Test public void testLongWithoutEqualSingleDash() throws Exception { - String[] args = new String[] { "-foobar" }; + final String[] args = new String[] { "-foobar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").hasArg().create('f')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertEquals("bar", cl.getOptionValue("foo")); } @@ -353,13 +353,13 @@ public abstract class ParserTestCase @Test public void testAmbiguousLongWithoutEqualSingleDash() throws Exception { - String[] args = new String[] { "-b", "-foobar" }; + final String[] args = new String[] { "-b", "-foobar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").hasOptionalArg().create('f')); options.addOption(OptionBuilder.withLongOpt("bar").hasOptionalArg().create('b')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue(cl.hasOption("b")); assertTrue(cl.hasOption("f")); @@ -369,12 +369,12 @@ public abstract class ParserTestCase @Test public void testLongWithoutEqualDoubleDash() throws Exception { - String[] args = new String[] { "--foobar" }; + final String[] args = new String[] { "--foobar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").hasArg().create('f')); - CommandLine cl = parser.parse(options, args, true); + final CommandLine cl = parser.parse(options, args, true); assertFalse(cl.hasOption("foo")); // foo isn't expected to be recognized with a double dash } @@ -382,16 +382,16 @@ public abstract class ParserTestCase @Test public void testLongWithUnexpectedArgument1() throws Exception { - String[] args = new String[] { "--foo=bar" }; + final String[] args = new String[] { "--foo=bar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").create('f')); try { parser.parse(options, args); } - catch (UnrecognizedOptionException e) + catch (final UnrecognizedOptionException e) { assertEquals("--foo=bar", e.getOption()); return; @@ -403,16 +403,16 @@ public abstract class ParserTestCase @Test public void testLongWithUnexpectedArgument2() throws Exception { - String[] args = new String[] { "-foobar" }; + final String[] args = new String[] { "-foobar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").create('f')); try { parser.parse(options, args); } - catch (UnrecognizedOptionException e) + catch (final UnrecognizedOptionException e) { assertEquals("-foobar", e.getOption()); return; @@ -424,16 +424,16 @@ public abstract class ParserTestCase @Test public void testShortWithUnexpectedArgument() throws Exception { - String[] args = new String[] { "-f=bar" }; + final String[] args = new String[] { "-f=bar" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("foo").create('f')); try { parser.parse(options, args); } - catch (UnrecognizedOptionException e) + catch (final UnrecognizedOptionException e) { assertEquals("-f=bar", e.getOption()); return; @@ -445,14 +445,14 @@ public abstract class ParserTestCase @Test public void testPropertiesOption1() throws Exception { - String[] args = new String[] { "-Jsource=1.5", "-J", "target", "1.5", "foo" }; + final String[] args = new String[] { "-Jsource=1.5", "-J", "target", "1.5", "foo" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withValueSeparator().hasArgs(2).create('J')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); - List<String> values = Arrays.asList(cl.getOptionValues("J")); + final List<String> values = Arrays.asList(cl.getOptionValues("J")); assertNotNull("null values", values); assertEquals("number of values", 4, values.size()); assertEquals("value 1", "source", values.get(0)); @@ -460,7 +460,7 @@ public abstract class ParserTestCase assertEquals("value 3", "target", values.get(2)); assertEquals("value 4", "1.5", values.get(3)); - List<?> argsleft = cl.getArgList(); + final List<?> argsleft = cl.getArgList(); assertEquals("Should be 1 arg left", 1, argsleft.size()); assertEquals("Expecting foo", "foo", argsleft.get(0)); } @@ -468,33 +468,33 @@ public abstract class ParserTestCase @Test public void testPropertiesOption2() throws Exception { - String[] args = new String[] { "-Dparam1", "-Dparam2=value2", "-D"}; + final String[] args = new String[] { "-Dparam1", "-Dparam2=value2", "-D"}; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withValueSeparator().hasOptionalArgs(2).create('D')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); - Properties props = cl.getOptionProperties("D"); + final Properties props = cl.getOptionProperties("D"); assertNotNull("null properties", props); assertEquals("number of properties in " + props, 2, props.size()); assertEquals("property 1", "true", props.getProperty("param1")); assertEquals("property 2", "value2", props.getProperty("param2")); - List<?> argsleft = cl.getArgList(); + final List<?> argsleft = cl.getArgList(); assertEquals("Should be no arg left", 0, argsleft.size()); } @Test public void testUnambiguousPartialLongOption1() throws Exception { - String[] args = new String[] { "--ver" }; + final String[] args = new String[] { "--ver" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("version").create()); options.addOption(OptionBuilder.withLongOpt("help").create()); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm --version is set", cl.hasOption("version")); } @@ -502,13 +502,13 @@ public abstract class ParserTestCase @Test public void testUnambiguousPartialLongOption2() throws Exception { - String[] args = new String[] { "-ver" }; + final String[] args = new String[] { "-ver" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("version").create()); options.addOption(OptionBuilder.withLongOpt("help").create()); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm --version is set", cl.hasOption("version")); } @@ -516,13 +516,13 @@ public abstract class ParserTestCase @Test public void testUnambiguousPartialLongOption3() throws Exception { - String[] args = new String[] { "--ver=1" }; + final String[] args = new String[] { "--ver=1" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("verbose").hasOptionalArg().create()); options.addOption(OptionBuilder.withLongOpt("help").create()); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm --verbose is set", cl.hasOption("verbose")); assertEquals("1", cl.getOptionValue("verbose")); @@ -531,13 +531,13 @@ public abstract class ParserTestCase @Test public void testUnambiguousPartialLongOption4() throws Exception { - String[] args = new String[] { "-ver=1" }; + final String[] args = new String[] { "-ver=1" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("verbose").hasOptionalArg().create()); options.addOption(OptionBuilder.withLongOpt("help").create()); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm --verbose is set", cl.hasOption("verbose")); assertEquals("1", cl.getOptionValue("verbose")); @@ -546,9 +546,9 @@ public abstract class ParserTestCase @Test public void testAmbiguousPartialLongOption1() throws Exception { - String[] args = new String[] { "--ver" }; + final String[] args = new String[] { "--ver" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("version").create()); options.addOption(OptionBuilder.withLongOpt("verbose").create()); @@ -558,7 +558,7 @@ public abstract class ParserTestCase { parser.parse(options, args); } - catch (AmbiguousOptionException e) + catch (final AmbiguousOptionException e) { caught = true; assertEquals("Partial option", "--ver", e.getOption()); @@ -572,9 +572,9 @@ public abstract class ParserTestCase @Test public void testAmbiguousPartialLongOption2() throws Exception { - String[] args = new String[] { "-ver" }; + final String[] args = new String[] { "-ver" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("version").create()); options.addOption(OptionBuilder.withLongOpt("verbose").create()); @@ -584,7 +584,7 @@ public abstract class ParserTestCase { parser.parse(options, args); } - catch (AmbiguousOptionException e) + catch (final AmbiguousOptionException e) { caught = true; assertEquals("Partial option", "-ver", e.getOption()); @@ -598,9 +598,9 @@ public abstract class ParserTestCase @Test public void testAmbiguousPartialLongOption3() throws Exception { - String[] args = new String[] { "--ver=1" }; + final String[] args = new String[] { "--ver=1" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("version").create()); options.addOption(OptionBuilder.withLongOpt("verbose").hasOptionalArg().create()); @@ -610,7 +610,7 @@ public abstract class ParserTestCase { parser.parse(options, args); } - catch (AmbiguousOptionException e) + catch (final AmbiguousOptionException e) { caught = true; assertEquals("Partial option", "--ver", e.getOption()); @@ -624,9 +624,9 @@ public abstract class ParserTestCase @Test public void testAmbiguousPartialLongOption4() throws Exception { - String[] args = new String[] { "-ver=1" }; + final String[] args = new String[] { "-ver=1" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("version").create()); options.addOption(OptionBuilder.withLongOpt("verbose").hasOptionalArg().create()); @@ -636,7 +636,7 @@ public abstract class ParserTestCase { parser.parse(options, args); } - catch (AmbiguousOptionException e) + catch (final AmbiguousOptionException e) { caught = true; assertEquals("Partial option", "-ver", e.getOption()); @@ -650,13 +650,13 @@ public abstract class ParserTestCase @Test public void testPartialLongOptionSingleDash() throws Exception { - String[] args = new String[] { "-ver" }; + final String[] args = new String[] { "-ver" }; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("version").create()); options.addOption(OptionBuilder.hasArg().create('v')); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm --version is set", cl.hasOption("version")); assertTrue("Confirm -v is not set", !cl.hasOption("v")); @@ -665,13 +665,13 @@ public abstract class ParserTestCase @Test public void testWithRequiredOption() throws Exception { - String[] args = new String[] { "-b", "file" }; + final String[] args = new String[] { "-b", "file" }; - Options options = new Options(); + final Options options = new Options(); options.addOption("a", "enable-a", false, null); options.addOption(OptionBuilder.withLongOpt("bfile").hasArg().isRequired().create('b')); - CommandLine cl = parser.parse(options,args); + final CommandLine cl = parser.parse(options,args); assertTrue("Confirm -a is NOT set", !cl.hasOption("a")); assertTrue("Confirm -b is set", cl.hasOption("b")); @@ -682,13 +682,13 @@ public abstract class ParserTestCase @Test public void testOptionAndRequiredOption() throws Exception { - String[] args = new String[] { "-a", "-b", "file" }; + final String[] args = new String[] { "-a", "-b", "file" }; - Options options = new Options(); + final Options options = new Options(); options.addOption("a", "enable-a", false, null); options.addOption(OptionBuilder.withLongOpt("bfile").hasArg().isRequired().create('b')); - CommandLine cl = parser.parse(options,args); + final CommandLine cl = parser.parse(options,args); assertTrue("Confirm -a is set", cl.hasOption("a")); assertTrue("Confirm -b is set", cl.hasOption("b")); @@ -699,9 +699,9 @@ public abstract class ParserTestCase @Test public void testMissingRequiredOption() { - String[] args = new String[] { "-a" }; + final String[] args = new String[] { "-a" }; - Options options = new Options(); + final Options options = new Options(); options.addOption("a", "enable-a", false, null); options.addOption(OptionBuilder.withLongOpt("bfile").hasArg().isRequired().create('b')); @@ -710,12 +710,12 @@ public abstract class ParserTestCase parser.parse(options,args); fail("exception should have been thrown"); } - catch (MissingOptionException e) + catch (final MissingOptionException e) { assertEquals( "Incorrect exception message", "Missing required option: b", e.getMessage() ); assertTrue(e.getMissingOptions().contains("b")); } - catch (ParseException e) + catch (final ParseException e) { fail("expected to catch MissingOptionException"); } @@ -724,9 +724,9 @@ public abstract class ParserTestCase @Test public void testMissingRequiredOptions() { - String[] args = new String[] { "-a" }; + final String[] args = new String[] { "-a" }; - Options options = new Options(); + final Options options = new Options(); options.addOption("a", "enable-a", false, null); options.addOption(OptionBuilder.withLongOpt("bfile").hasArg().isRequired().create('b')); options.addOption(OptionBuilder.withLongOpt("cfile").hasArg().isRequired().create('c')); @@ -736,13 +736,13 @@ public abstract class ParserTestCase parser.parse(options,args); fail("exception should have been thrown"); } - catch (MissingOptionException e) + catch (final MissingOptionException e) { assertEquals("Incorrect exception message", "Missing required options: b, c", e.getMessage()); assertTrue(e.getMissingOptions().contains("b")); assertTrue(e.getMissingOptions().contains("c")); } - catch (ParseException e) + catch (final ParseException e) { fail("expected to catch MissingOptionException"); } @@ -751,12 +751,12 @@ public abstract class ParserTestCase @Test public void testMissingRequiredGroup() throws Exception { - OptionGroup group = new OptionGroup(); + final OptionGroup group = new OptionGroup(); group.addOption(OptionBuilder.create("a")); group.addOption(OptionBuilder.create("b")); group.setRequired(true); - Options options = new Options(); + final Options options = new Options(); options.addOptionGroup(group); options.addOption(OptionBuilder.isRequired().create("c")); @@ -765,12 +765,12 @@ public abstract class ParserTestCase parser.parse(options, new String[] { "-c" }); fail("MissingOptionException not thrown"); } - catch (MissingOptionException e) + catch (final MissingOptionException e) { assertEquals(1, e.getMissingOptions().size()); assertTrue(e.getMissingOptions().get(0) instanceof OptionGroup); } - catch (ParseException e) + catch (final ParseException e) { fail("Expected to catch MissingOptionException"); } @@ -779,11 +779,11 @@ public abstract class ParserTestCase @Test public void testOptionGroup() throws Exception { - OptionGroup group = new OptionGroup(); + final OptionGroup group = new OptionGroup(); group.addOption(OptionBuilder.create("a")); group.addOption(OptionBuilder.create("b")); - Options options = new Options(); + final Options options = new Options(); options.addOptionGroup(group); parser.parse(options, new String[] { "-b" }); @@ -794,14 +794,14 @@ public abstract class ParserTestCase @Test public void testOptionGroupLong() throws Exception { - OptionGroup group = new OptionGroup(); + final OptionGroup group = new OptionGroup(); group.addOption(OptionBuilder.withLongOpt("foo").create()); group.addOption(OptionBuilder.withLongOpt("bar").create()); - Options options = new Options(); + final Options options = new Options(); options.addOptionGroup(group); - CommandLine cl = parser.parse(options, new String[] { "--bar" }); + final CommandLine cl = parser.parse(options, new String[] { "--bar" }); assertTrue(cl.hasOption("bar")); assertEquals("selected option", "bar", group.getSelected()); @@ -810,7 +810,7 @@ public abstract class ParserTestCase @Test public void testReuseOptionsTwice() throws Exception { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption(OptionBuilder.isRequired().create('v')); // first parsing @@ -822,7 +822,7 @@ public abstract class ParserTestCase parser.parse(opts, new String[0]); fail("MissingOptionException not thrown"); } - catch (MissingOptionException e) + catch (final MissingOptionException e) { // expected } @@ -831,9 +831,9 @@ public abstract class ParserTestCase @Test public void testBursting() throws Exception { - String[] args = new String[] { "-acbtoast", "foo", "bar" }; + final String[] args = new String[] { "-acbtoast", "foo", "bar" }; - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue( "Confirm -a is set", cl.hasOption("a") ); assertTrue( "Confirm -b is set", cl.hasOption("b") ); @@ -845,14 +845,14 @@ public abstract class ParserTestCase @Test public void testUnrecognizedOptionWithBursting() throws Exception { - String[] args = new String[] { "-adbtoast", "foo", "bar" }; + final String[] args = new String[] { "-adbtoast", "foo", "bar" }; try { parser.parse(options, args); fail("UnrecognizedOptionException wasn't thrown"); } - catch (UnrecognizedOptionException e) + catch (final UnrecognizedOptionException e) { assertEquals("-adbtoast", e.getOption()); } @@ -861,7 +861,7 @@ public abstract class ParserTestCase @Test public void testMissingArgWithBursting() throws Exception { - String[] args = new String[] { "-acb" }; + final String[] args = new String[] { "-acb" }; boolean caught = false; @@ -869,7 +869,7 @@ public abstract class ParserTestCase { parser.parse(options, args); } - catch (MissingArgumentException e) + catch (final MissingArgumentException e) { caught = true; assertEquals("option missing an argument", "b", e.getOption().getOpt()); @@ -881,9 +881,9 @@ public abstract class ParserTestCase @Test public void testStopBursting() throws Exception { - String[] args = new String[] { "-azc" }; + final String[] args = new String[] { "-azc" }; - CommandLine cl = parser.parse(options, args, true); + final CommandLine cl = parser.parse(options, args, true); assertTrue( "Confirm -a is set", cl.hasOption("a") ); assertFalse( "Confirm -c is not set", cl.hasOption("c") ); @@ -894,7 +894,7 @@ public abstract class ParserTestCase @Test public void testStopBursting2() throws Exception { - String[] args = new String[] { "-c", "foobar", "-btoast" }; + final String[] args = new String[] { "-c", "foobar", "-btoast" }; CommandLine cl = parser.parse(options, args, true); assertTrue("Confirm -c is set", cl.hasOption("c")); @@ -912,13 +912,13 @@ public abstract class ParserTestCase @Test public void testUnlimitedArgs() throws Exception { - String[] args = new String[]{"-e", "one", "two", "-f", "alpha"}; + final String[] args = new String[]{"-e", "one", "two", "-f", "alpha"}; - Options options = new Options(); + final Options options = new Options(); options.addOption(OptionBuilder.hasArgs().create("e")); options.addOption(OptionBuilder.hasArgs().create("f")); - CommandLine cl = parser.parse(options, args); + final CommandLine cl = parser.parse(options, args); assertTrue("Confirm -e is set", cl.hasOption("e")); assertEquals("number of arg for -e", 2, cl.getOptionValues("e").length); @@ -940,13 +940,13 @@ public abstract class ParserTestCase @Test public void testPropertyOptionSingularValue() throws Exception { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption(OptionBuilder.hasOptionalArgs(2).withLongOpt("hide").create()); - Properties properties = new Properties(); + final Properties properties = new Properties(); properties.setProperty( "hide", "seek" ); - CommandLine cmd = parse(parser, opts, null, properties); + final CommandLine cmd = parse(parser, opts, null, properties); assertTrue( cmd.hasOption("hide") ); assertEquals( "seek", cmd.getOptionValue("hide") ); assertTrue( !cmd.hasOption("fake") ); @@ -955,7 +955,7 @@ public abstract class ParserTestCase @Test public void testPropertyOptionFlags() throws Exception { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption("a", false, "toggle -a"); opts.addOption("c", "c", false, "toggle -c"); opts.addOption(OptionBuilder.hasOptionalArg().create('e')); @@ -1015,15 +1015,15 @@ public abstract class ParserTestCase @Test public void testPropertyOptionMultipleValues() throws Exception { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption(OptionBuilder.hasArgs().withValueSeparator(',').create('k')); - Properties properties = new Properties(); + final Properties properties = new Properties(); properties.setProperty( "k", "one,two" ); - String[] values = new String[] { "one", "two" }; + final String[] values = new String[] { "one", "two" }; - CommandLine cmd = parse(parser, opts, null, properties); + final CommandLine cmd = parse(parser, opts, null, properties); assertTrue( cmd.hasOption("k") ); assertTrue( Arrays.equals( values, cmd.getOptionValues('k') ) ); } @@ -1031,16 +1031,16 @@ public abstract class ParserTestCase @Test public void testPropertyOverrideValues() throws Exception { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption(OptionBuilder.hasOptionalArgs(2).create('i')); opts.addOption(OptionBuilder.hasOptionalArgs().create('j')); - String[] args = new String[] { "-j", "found", "-i", "ink" }; + final String[] args = new String[] { "-j", "found", "-i", "ink" }; - Properties properties = new Properties(); + final Properties properties = new Properties(); properties.setProperty( "j", "seek" ); - CommandLine cmd = parse(parser, opts, args, properties); + final CommandLine cmd = parse(parser, opts, args, properties); assertTrue( cmd.hasOption("j") ); assertEquals( "found", cmd.getOptionValue("j") ); assertTrue( cmd.hasOption("i") ); @@ -1051,28 +1051,28 @@ public abstract class ParserTestCase @Test public void testPropertyOptionRequired() throws Exception { - Options opts = new Options(); + final Options opts = new Options(); opts.addOption(OptionBuilder.isRequired().create("f")); - Properties properties = new Properties(); + final Properties properties = new Properties(); properties.setProperty("f", "true"); - CommandLine cmd = parse(parser, opts, null, properties); + final CommandLine cmd = parse(parser, opts, null, properties); assertTrue(cmd.hasOption("f")); } @Test public void testPropertyOptionUnexpected() throws Exception { - Options opts = new Options(); + final Options opts = new Options(); - Properties properties = new Properties(); + final Properties properties = new Properties(); properties.setProperty("f", "true"); try { parse(parser, opts, null, properties); fail("UnrecognizedOptionException expected"); - } catch (UnrecognizedOptionException e) { + } catch (final UnrecognizedOptionException e) { // expected } } @@ -1080,25 +1080,25 @@ public abstract class ParserTestCase @Test public void testPropertyOptionGroup() throws Exception { - Options opts = new Options(); + final Options opts = new Options(); - OptionGroup group1 = new OptionGroup(); + final OptionGroup group1 = new OptionGroup(); group1.addOption(new Option("a", null)); group1.addOption(new Option("b", null)); opts.addOptionGroup(group1); - OptionGroup group2 = new OptionGroup(); + final OptionGroup group2 = new OptionGroup(); group2.addOption(new Option("x", null)); group2.addOption(new Option("y", null)); opts.addOptionGroup(group2); - String[] args = new String[] { "-a" }; + final String[] args = new String[] { "-a" }; - Properties properties = new Properties(); + final Properties properties = new Properties(); properties.put("b", "true"); properties.put("x", "true"); - CommandLine cmd = parse(parser, opts, args, properties); + final CommandLine cmd = parse(parser, opts, args, properties); assertTrue(cmd.hasOption("a")); assertFalse(cmd.hasOption("b")); Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/PatternOptionBuilderTest.java Mon Jun 5 16:37:32 2017 @@ -40,11 +40,11 @@ public class PatternOptionBuilderTest @Test public void testSimplePattern() throws Exception { - Options options = PatternOptionBuilder.parsePattern("a:b@cde>f+n%t/m*z#"); - String[] args = new String[] {"-c", "-a", "foo", "-b", "java.util.Vector", "-e", "build.xml", "-f", "java.util.Calendar", "-n", "4.5", "-t", "http://commons.apache.org", "-z", "Thu Jun 06 17:48:57 EDT 2002", "-m", "test*"}; + final Options options = PatternOptionBuilder.parsePattern("a:b@cde>f+n%t/m*z#"); + final String[] args = new String[] {"-c", "-a", "foo", "-b", "java.util.Vector", "-e", "build.xml", "-f", "java.util.Calendar", "-n", "4.5", "-t", "http://commons.apache.org", "-z", "Thu Jun 06 17:48:57 EDT 2002", "-m", "test*"}; - CommandLineParser parser = new PosixParser(); - CommandLine line = parser.parse(options, args); + final CommandLineParser parser = new PosixParser(); + final CommandLine line = parser.parse(options, args); assertEquals("flag a", "foo", line.getOptionValue("a")); assertEquals("string flag a", "foo", line.getOptionObject("a")); @@ -71,7 +71,7 @@ public class PatternOptionBuilderTest try { assertEquals("files flag m", new File[0], line.getOptionObject('m')); fail("Multiple files are not supported yet, should have failed"); - } catch(UnsupportedOperationException uoe) { + } catch(final UnsupportedOperationException uoe) { // expected } @@ -79,7 +79,7 @@ public class PatternOptionBuilderTest try { assertEquals("date flag z", new Date(1023400137276L), line.getOptionObject('z')); fail("Date is not supported yet, should have failed"); - } catch(UnsupportedOperationException uoe) { + } catch(final UnsupportedOperationException uoe) { // expected } } @@ -87,16 +87,16 @@ public class PatternOptionBuilderTest @Test public void testEmptyPattern() throws Exception { - Options options = PatternOptionBuilder.parsePattern(""); + final Options options = PatternOptionBuilder.parsePattern(""); assertTrue(options.getOptions().isEmpty()); } @Test public void testUntypedPattern() throws Exception { - Options options = PatternOptionBuilder.parsePattern("abc"); - CommandLineParser parser = new PosixParser(); - CommandLine line = parser.parse(options, new String[] { "-abc" }); + final Options options = PatternOptionBuilder.parsePattern("abc"); + final CommandLineParser parser = new PosixParser(); + final CommandLine line = parser.parse(options, new String[] { "-abc" }); assertTrue(line.hasOption('a')); assertNull("value a", line.getOptionObject('a')); @@ -109,9 +109,9 @@ public class PatternOptionBuilderTest @Test public void testNumberPattern() throws Exception { - Options options = PatternOptionBuilder.parsePattern("n%d%x%"); - CommandLineParser parser = new PosixParser(); - CommandLine line = parser.parse(options, new String[] { "-n", "1", "-d", "2.1", "-x", "3,5" }); + final Options options = PatternOptionBuilder.parsePattern("n%d%x%"); + final CommandLineParser parser = new PosixParser(); + final CommandLine line = parser.parse(options, new String[] { "-n", "1", "-d", "2.1", "-x", "3,5" }); assertEquals("n object class", Long.class, line.getOptionObject("n").getClass()); assertEquals("n value", new Long(1), line.getOptionObject("n")); @@ -125,9 +125,9 @@ public class PatternOptionBuilderTest @Test public void testClassPattern() throws Exception { - Options options = PatternOptionBuilder.parsePattern("c+d+"); - CommandLineParser parser = new PosixParser(); - CommandLine line = parser.parse(options, new String[] { "-c", "java.util.Calendar", "-d", "System.DateTime" }); + final Options options = PatternOptionBuilder.parsePattern("c+d+"); + final CommandLineParser parser = new PosixParser(); + final CommandLine line = parser.parse(options, new String[] { "-c", "java.util.Calendar", "-d", "System.DateTime" }); assertEquals("c value", Calendar.class, line.getOptionObject("c")); assertNull("d value", line.getOptionObject("d")); @@ -136,9 +136,9 @@ public class PatternOptionBuilderTest @Test public void testObjectPattern() throws Exception { - Options options = PatternOptionBuilder.parsePattern("o@i@n@"); - CommandLineParser parser = new PosixParser(); - CommandLine line = parser.parse(options, new String[] { "-o", "java.lang.String", "-i", "java.util.Calendar", "-n", "System.DateTime" }); + final Options options = PatternOptionBuilder.parsePattern("o@i@n@"); + final CommandLineParser parser = new PosixParser(); + final CommandLine line = parser.parse(options, new String[] { "-o", "java.lang.String", "-i", "java.util.Calendar", "-n", "System.DateTime" }); assertEquals("o value", "", line.getOptionObject("o")); assertNull("i value", line.getOptionObject("i")); @@ -148,9 +148,9 @@ public class PatternOptionBuilderTest @Test public void testURLPattern() throws Exception { - Options options = PatternOptionBuilder.parsePattern("u/v/"); - CommandLineParser parser = new PosixParser(); - CommandLine line = parser.parse(options, new String[] { "-u", "http://commons.apache.org", "-v", "foo://commons.apache.org" }); + final Options options = PatternOptionBuilder.parsePattern("u/v/"); + final CommandLineParser parser = new PosixParser(); + final CommandLine line = parser.parse(options, new String[] { "-u", "http://commons.apache.org", "-v", "foo://commons.apache.org" }); assertEquals("u value", new URL("http://commons.apache.org"), line.getOptionObject("u")); assertNull("v value", line.getOptionObject("v")); @@ -159,9 +159,9 @@ public class PatternOptionBuilderTest @Test public void testExistingFilePattern() throws Exception { - Options options = PatternOptionBuilder.parsePattern("f<"); - CommandLineParser parser = new PosixParser(); - CommandLine line = parser.parse(options, new String[] { "-f", "test.properties" }); + final Options options = PatternOptionBuilder.parsePattern("f<"); + final CommandLineParser parser = new PosixParser(); + final CommandLine line = parser.parse(options, new String[] { "-f", "test.properties" }); assertEquals("f value", new File("test.properties"), line.getOptionObject("f")); @@ -171,15 +171,15 @@ public class PatternOptionBuilderTest @Test public void testRequiredOption() throws Exception { - Options options = PatternOptionBuilder.parsePattern("!n%m%"); - CommandLineParser parser = new PosixParser(); + final Options options = PatternOptionBuilder.parsePattern("!n%m%"); + final CommandLineParser parser = new PosixParser(); try { parser.parse(options, new String[]{""}); fail("MissingOptionException wasn't thrown"); } - catch (MissingOptionException e) + catch (final MissingOptionException e) { assertEquals(1, e.getMissingOptions().size()); assertTrue(e.getMissingOptions().contains("n")); Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValueTest.java Mon Jun 5 16:37:32 2017 @@ -46,13 +46,13 @@ public class ValueTest opts.addOption(OptionBuilder.hasOptionalArgs(2).create('i')); opts.addOption(OptionBuilder.hasOptionalArgs().create('j')); - String[] args = new String[] { "-a", + final String[] args = new String[] { "-a", "-b", "foo", "--c", "--d", "bar" }; - Parser parser = new PosixParser(); + final Parser parser = new PosixParser(); _cl = parser.parse(opts,args); } @@ -119,10 +119,10 @@ public class ValueTest @Test public void testShortOptionalArgNoValue() throws Exception { - String[] args = new String[] { "-e" }; + final String[] args = new String[] { "-e" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("e") ); assertNull( cmd.getOptionValue("e") ); } @@ -130,10 +130,10 @@ public class ValueTest @Test public void testShortOptionalArgNoValueWithOption() throws Exception { - String[] args = new String[] { "-e" }; + final String[] args = new String[] { "-e" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption(opts.getOption("e")) ); assertNull( cmd.getOptionValue(opts.getOption("e")) ); } @@ -141,10 +141,10 @@ public class ValueTest @Test public void testShortOptionalArgValue() throws Exception { - String[] args = new String[] { "-e", "everything" }; + final String[] args = new String[] { "-e", "everything" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("e") ); assertEquals( "everything", cmd.getOptionValue("e") ); } @@ -152,10 +152,10 @@ public class ValueTest @Test public void testShortOptionalArgValueWithOption() throws Exception { - String[] args = new String[] { "-e", "everything" }; + final String[] args = new String[] { "-e", "everything" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption(opts.getOption("e")) ); assertEquals( "everything", cmd.getOptionValue(opts.getOption("e")) ); } @@ -163,10 +163,10 @@ public class ValueTest @Test public void testLongOptionalNoValue() throws Exception { - String[] args = new String[] { "--fish" }; + final String[] args = new String[] { "--fish" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("fish") ); assertNull( cmd.getOptionValue("fish") ); } @@ -174,10 +174,10 @@ public class ValueTest @Test public void testLongOptionalNoValueWithOption() throws Exception { - String[] args = new String[] { "--fish" }; + final String[] args = new String[] { "--fish" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption(opts.getOption("fish")) ); assertNull( cmd.getOptionValue(opts.getOption("fish")) ); } @@ -185,10 +185,10 @@ public class ValueTest @Test public void testLongOptionalArgValue() throws Exception { - String[] args = new String[] { "--fish", "face" }; + final String[] args = new String[] { "--fish", "face" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("fish") ); assertEquals( "face", cmd.getOptionValue("fish") ); } @@ -196,10 +196,10 @@ public class ValueTest @Test public void testLongOptionalArgValueWithOption() throws Exception { - String[] args = new String[] { "--fish", "face" }; + final String[] args = new String[] { "--fish", "face" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption(opts.getOption("fish")) ); assertEquals( "face", cmd.getOptionValue(opts.getOption("fish")) ); } @@ -207,10 +207,10 @@ public class ValueTest @Test public void testShortOptionalArgValues() throws Exception { - String[] args = new String[] { "-j", "ink", "idea" }; + final String[] args = new String[] { "-j", "ink", "idea" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("j") ); assertEquals( "ink", cmd.getOptionValue("j") ); assertEquals( "ink", cmd.getOptionValues("j")[0] ); @@ -221,10 +221,10 @@ public class ValueTest @Test public void testShortOptionalArgValuesWithOption() throws Exception { - String[] args = new String[] { "-j", "ink", "idea" }; + final String[] args = new String[] { "-j", "ink", "idea" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption(opts.getOption("j")) ); assertEquals( "ink", cmd.getOptionValue(opts.getOption("j")) ); assertEquals( "ink", cmd.getOptionValues(opts.getOption("j"))[0] ); @@ -235,10 +235,10 @@ public class ValueTest @Test public void testLongOptionalArgValues() throws Exception { - String[] args = new String[] { "--gravy", "gold", "garden" }; + final String[] args = new String[] { "--gravy", "gold", "garden" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("gravy") ); assertEquals( "gold", cmd.getOptionValue("gravy") ); assertEquals( "gold", cmd.getOptionValues("gravy")[0] ); @@ -249,10 +249,10 @@ public class ValueTest @Test public void testLongOptionalArgValuesWithOption() throws Exception { - String[] args = new String[] { "--gravy", "gold", "garden" }; + final String[] args = new String[] { "--gravy", "gold", "garden" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption(opts.getOption("gravy")) ); assertEquals( "gold", cmd.getOptionValue(opts.getOption("gravy")) ); assertEquals( "gold", cmd.getOptionValues(opts.getOption("gravy"))[0] ); @@ -263,10 +263,10 @@ public class ValueTest @Test public void testShortOptionalNArgValues() throws Exception { - String[] args = new String[] { "-i", "ink", "idea", "isotope", "ice" }; + final String[] args = new String[] { "-i", "ink", "idea", "isotope", "ice" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("i") ); assertEquals( "ink", cmd.getOptionValue("i") ); assertEquals( "ink", cmd.getOptionValues("i")[0] ); @@ -279,10 +279,10 @@ public class ValueTest @Test public void testShortOptionalNArgValuesWithOption() throws Exception { - String[] args = new String[] { "-i", "ink", "idea", "isotope", "ice" }; + final String[] args = new String[] { "-i", "ink", "idea", "isotope", "ice" }; - Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final Parser parser = new PosixParser(); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("i") ); assertEquals( "ink", cmd.getOptionValue(opts.getOption("i")) ); assertEquals( "ink", cmd.getOptionValues(opts.getOption("i"))[0] ); @@ -295,13 +295,13 @@ public class ValueTest @Test public void testLongOptionalNArgValues() throws Exception { - String[] args = new String[] { + final String[] args = new String[] { "--hide", "house", "hair", "head" }; - Parser parser = new PosixParser(); + final Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption("hide") ); assertEquals( "house", cmd.getOptionValue("hide") ); assertEquals( "house", cmd.getOptionValues("hide")[0] ); @@ -313,13 +313,13 @@ public class ValueTest @Test public void testLongOptionalNArgValuesWithOption() throws Exception { - String[] args = new String[] { + final String[] args = new String[] { "--hide", "house", "hair", "head" }; - Parser parser = new PosixParser(); + final Parser parser = new PosixParser(); - CommandLine cmd = parser.parse(opts,args); + final CommandLine cmd = parser.parse(opts,args); assertTrue( cmd.hasOption(opts.getOption("hide")) ); assertEquals( "house", cmd.getOptionValue(opts.getOption("hide")) ); assertEquals( "house", cmd.getOptionValues(opts.getOption("hide"))[0] ); Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/ValuesTest.java Mon Jun 5 16:37:32 2017 @@ -33,7 +33,7 @@ public class ValuesTest @Before public void setUp() throws Exception { - Options options = new Options(); + final Options options = new Options(); options.addOption("a", false, "toggle -a"); options.addOption("b", true, "set -b"); @@ -49,7 +49,7 @@ public class ValuesTest options.addOption(OptionBuilder.withLongOpt("k").hasArgs().withDescription("set -k").withValueSeparator('=').create('k')); options.addOption(OptionBuilder.withLongOpt("m").hasArgs().withDescription("set -m").withValueSeparator().create('m')); - String[] args = new String[] { "-a", + final String[] args = new String[] { "-a", "-b", "foo", "--c", "--d", "bar", @@ -65,7 +65,7 @@ public class ValuesTest "-kkey2=value2", "-mkey=value"}; - CommandLineParser parser = new PosixParser(); + final CommandLineParser parser = new PosixParser(); cmd = parser.parse(options,args); } Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI133Test.java Mon Jun 5 16:37:32 2017 @@ -31,11 +31,11 @@ public class BugCLI133Test { @Test public void testOrder() throws ParseException { - Option optionA = new Option("a", "first"); - Options opts = new Options(); + final Option optionA = new Option("a", "first"); + final Options opts = new Options(); opts.addOption(optionA); - PosixParser posixParser = new PosixParser(); - CommandLine line = posixParser.parse(opts, null); + final PosixParser posixParser = new PosixParser(); + final CommandLine line = posixParser.parse(opts, null); assertFalse(line.hasOption((String)null)); } } Modified: commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java?rev=1797673&r1=1797672&r2=1797673&view=diff ============================================================================== --- commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java (original) +++ commons/proper/cli/trunk/src/test/java/org/apache/commons/cli/bug/BugCLI13Test.java Mon Jun 5 16:37:32 2017 @@ -36,15 +36,16 @@ public class BugCLI13Test { final String debugOpt = "debug"; @SuppressWarnings("static-access") + final Option debug = OptionBuilder .withArgName( debugOpt ) .withDescription( "turn on debugging" ) .withLongOpt( debugOpt ) .hasArg() .create( 'd' ); - Options options = new Options(); + final Options options = new Options(); options.addOption( debug ); - CommandLine commandLine = new PosixParser().parse( options, new String[]{"-d", "true"} ); + final CommandLine commandLine = new PosixParser().parse( options, new String[]{"-d", "true"} ); assertEquals("true", commandLine.getOptionValue( debugOpt )); assertEquals("true", commandLine.getOptionValue( 'd' ));
