diff --git a/airline-core/src/main/java/com/github/rvesse/airline/Cli.java b/airline-core/src/main/java/com/github/rvesse/airline/Cli.java index f1b1cace6..2a7410b06 100644 --- a/airline-core/src/main/java/com/github/rvesse/airline/Cli.java +++ b/airline-core/src/main/java/com/github/rvesse/airline/Cli.java @@ -30,7 +30,7 @@ * @deprecated Renamed to {@link CommandLineInterface} to avoid ambiguity with * {@link com.github.rvesse.airline.annotations.Cli} annotation */ -@Deprecated +@Deprecated(forRemoval = true) public class Cli extends CommandLineInterface { /** @@ -45,7 +45,7 @@ public class Cli extends CommandLineInterface { * with {@link com.github.rvesse.airline.annotations.Cli} * annotation */ - @Deprecated + @Deprecated(forRemoval = true) public static CliBuilder builder(String name) { if (name == null) throw new NullPointerException("name cannot be null"); @@ -62,7 +62,7 @@ public static CliBuilder builder(String name) { * with {@link com.github.rvesse.airline.annotations.Cli} * annotation */ - @Deprecated + @Deprecated(forRemoval = true) public Cli(Class cliClass) { this(MetadataLoader. loadGlobal(cliClass)); } @@ -82,7 +82,7 @@ public Cli(Class cliClass) { * with {@link com.github.rvesse.airline.annotations.Cli} * annotation */ - @Deprecated + @Deprecated(forRemoval = true) public Cli(Class cliClass, ParserMetadata parserConfig) { this(MetadataLoader. loadGlobal(cliClass, parserConfig)); } @@ -96,7 +96,7 @@ public Cli(Class cliClass, ParserMetadata parserConfig) { * with {@link com.github.rvesse.airline.annotations.Cli} * annotation */ - @Deprecated + @Deprecated(forRemoval = true) public Cli(GlobalMetadata metadata) { super(metadata); } diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/Git.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/Git.java index 15bfe90fa..d9b919a5c 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/Git.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/Git.java @@ -17,6 +17,7 @@ import java.util.List; +import com.github.rvesse.airline.CommandLineInterface; import com.github.rvesse.airline.annotations.Arguments; import com.github.rvesse.airline.annotations.Command; import com.github.rvesse.airline.annotations.Option; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/GitWithCliAnnotation.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/GitWithCliAnnotation.java index 621ea81b8..53f6183c9 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/GitWithCliAnnotation.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/GitWithCliAnnotation.java @@ -15,6 +15,7 @@ */ package com.github.rvesse.airline.tests; +import com.github.rvesse.airline.CommandLineInterface; import com.github.rvesse.airline.tests.Git.Add; import com.github.rvesse.airline.tests.Git.RemoteAdd; import com.github.rvesse.airline.tests.Git.RemoteShow; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/GitWithCliAnnotation2.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/GitWithCliAnnotation2.java index af976691f..568574c88 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/GitWithCliAnnotation2.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/GitWithCliAnnotation2.java @@ -15,6 +15,7 @@ */ package com.github.rvesse.airline.tests; +import com.github.rvesse.airline.CommandLineInterface; import com.github.rvesse.airline.tests.Git.Add; import com.github.rvesse.airline.tests.Git.RemoteAdd; import com.github.rvesse.airline.tests.Git.RemoteShow; @@ -47,7 +48,7 @@ public class GitWithCliAnnotation2 extends Git { public static void run(String[] args) { - CommandLineInterface gitParser = new CommandLineInterface( + CommandLineInterface gitParser = new CommandLineInterface<>( GitWithCliAnnotation2.class); gitParser.parse(args).run(); diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestCommandSuppression.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestCommandSuppression.java index 0af50f3b2..1d6964b47 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestCommandSuppression.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestCommandSuppression.java @@ -16,6 +16,7 @@ package com.github.rvesse.airline.tests; import com.github.rvesse.airline.Cli; +import com.github.rvesse.airline.CommandLineInterface; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestDefaultCommand.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestDefaultCommand.java index 0afd43c62..267f7cb08 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestDefaultCommand.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestDefaultCommand.java @@ -19,6 +19,7 @@ import java.util.List; import com.github.rvesse.airline.Cli; +import com.github.rvesse.airline.CommandLineInterface; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestGalaxyCommandLineParserByAnnotation.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestGalaxyCommandLineParserByAnnotation.java index f11263616..08a8b4393 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestGalaxyCommandLineParserByAnnotation.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestGalaxyCommandLineParserByAnnotation.java @@ -16,6 +16,7 @@ package com.github.rvesse.airline.tests; import com.github.rvesse.airline.Cli; +import com.github.rvesse.airline.CommandLineInterface; import org.testng.annotations.Test; import com.github.rvesse.airline.tests.TestGalaxyCommandLineParser.AgentAddCommand; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestGitByAnnotation.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestGitByAnnotation.java index ffdd5b848..ef92ee384 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestGitByAnnotation.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestGitByAnnotation.java @@ -15,6 +15,7 @@ */ package com.github.rvesse.airline.tests; +import com.github.rvesse.airline.CommandLineInterface; import org.apache.commons.lang3.StringUtils; import org.testng.Assert; import org.testng.annotations.Test; @@ -69,7 +70,7 @@ public void testParserConfigOverride2() { gitOverridden(parserConfig, "remote", "sh"); // This returns help because the alias definition from the base config is overridden by the provided parser config - CommandLineInterface gitParser = new CommandLineInterface( + CommandLineInterface gitParser = new CommandLineInterface<>( GitWithCliAnnotation2.class, parserConfig); Runnable cmd = gitParser.parse("foo"); Assert.assertEquals(cmd.getClass(), Help.class); @@ -83,7 +84,7 @@ private void git(String... args) { private void git(ParserMetadata parserConfig, String... args) { System.out.println("$ git " + StringUtils.join(args, ' ')); - CommandLineInterface gitParser = new CommandLineInterface( + CommandLineInterface gitParser = new CommandLineInterface<>( GitWithCliAnnotation.class, parserConfig); gitParser.parse(args).run(); @@ -92,7 +93,7 @@ private void git(ParserMetadata parserConfig, String... args) { private void gitOverridden(ParserMetadata parserConfig, String... args) { System.out.println("$ git " + StringUtils.join(args, ' ')); - CommandLineInterface gitParser = new CommandLineInterface( + CommandLineInterface gitParser = new CommandLineInterface<>( GitWithCliAnnotation2.class, parserConfig); gitParser.parse(args).run(); diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestOptionScope.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestOptionScope.java index b05f5fa71..32a2b86c4 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestOptionScope.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestOptionScope.java @@ -15,7 +15,7 @@ */ package com.github.rvesse.airline.tests; -import com.github.rvesse.airline.Cli; +import com.github.rvesse.airline.CommandLineInterface; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestParametersDelegate.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestParametersDelegate.java index edf38ce4d..957544aef 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestParametersDelegate.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestParametersDelegate.java @@ -16,6 +16,7 @@ package com.github.rvesse.airline.tests; import com.github.rvesse.airline.Cli; +import com.github.rvesse.airline.CommandLineInterface; import com.github.rvesse.airline.SingleCommand; import com.github.rvesse.airline.annotations.*; import com.github.rvesse.airline.builder.ParserBuilder; @@ -64,10 +65,10 @@ public static class EmptyDelegate { @Test public void delegatingEmptyClassHasNoEffect() { - DelegatingEmptyClassHasNoEffect p = Cli.builder("foo") - .withCommand(DelegatingEmptyClassHasNoEffect.class) - .build() - .parse("command", "-a", "-b", "someValue"); + DelegatingEmptyClassHasNoEffect p = CommandLineInterface.builder("foo") + .withCommand(DelegatingEmptyClassHasNoEffect.class) + .build() + .parse("command", "-a", "-b", "someValue"); assertTrue(p.isA); assertEquals(p.bValue, "someValue"); diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestSubGroups.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestSubGroups.java index 5270dd239..29185df68 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/TestSubGroups.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/TestSubGroups.java @@ -198,7 +198,7 @@ public void sub_groups_help_02() throws IOException { public void sub_groups_help_02_without_help_command() throws IOException { //@formatter:off CliBuilder builder - = Cli.builder("test"); + = CommandLineInterface.builder("test"); builder.withGroup("foo") .withSubGroup("bar") .withDefaultCommand(Help.class); diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositional.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositional.java index 4ca27fcfe..43196c9b4 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositional.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositional.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalConflict.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalConflict.java index 342cbb60e..4791d7616 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalConflict.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalConflict.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalDuplicate.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalDuplicate.java index 9c8b339e2..8ba0112e1 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalDuplicate.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalDuplicate.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalGap.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalGap.java index 58c576671..798634a00 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalGap.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalGap.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalNoExtras.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalNoExtras.java index c8b3ac882..a4421d6b8 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalNoExtras.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalNoExtras.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalOverride.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalOverride.java index 4da19b65f..20e7006d1 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalOverride.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalOverride.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.rvesse.airline.tests.args.positional; import com.github.rvesse.airline.annotations.Command; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalOverrideChild.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalOverrideChild.java index 9040673e1..beed46548 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalOverrideChild.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalOverrideChild.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.rvesse.airline.tests.args.positional; import com.github.rvesse.airline.annotations.Command; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalRequiredAfterOptional.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalRequiredAfterOptional.java index d04bcb578..efdae274c 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalRequiredAfterOptional.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalRequiredAfterOptional.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalRequiredAfterOptional2.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalRequiredAfterOptional2.java index a6125845c..c34b16212 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalRequiredAfterOptional2.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/ArgsPositionalRequiredAfterOptional2.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/TestPositionalArgs.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/TestPositionalArgs.java index 98cc003b8..1e2a7a811 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/TestPositionalArgs.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/args/positional/TestPositionalArgs.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-22 the original author or authors. +/** + * Copyright (C) 2010-16 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.github.rvesse.airline.tests.args.positional; import com.github.rvesse.airline.SingleCommand; @@ -21,7 +20,7 @@ import com.github.rvesse.airline.model.PositionalArgumentMetadata; import com.github.rvesse.airline.parser.errors.ParseArgumentsUnexpectedException; -import static com.github.rvesse.airline.TestingUtil.singleCommandParser; +import static com.github.rvesse.airline.tests.TestingUtil.singleCommandParser; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; @@ -56,7 +55,7 @@ public void positional_args_01() { ArgsPositional cmd = parser.parse("example.txt", "600", "extra"); assertEquals(cmd.file, "example.txt"); - assertEquals(cmd.mode, new Integer(600)); + assertEquals(cmd.mode, Integer.valueOf(600)); assertEquals(cmd.parameters.size(), 1); assertEquals(cmd.parameters.get(0), "extra"); } @@ -67,7 +66,7 @@ public void positional_args_02() { ArgsPositional cmd = parser.parse("example.txt", "600", "extra", "other", "another"); assertEquals(cmd.file, "example.txt"); - assertEquals(cmd.mode, new Integer(600)); + assertEquals(cmd.mode, Integer.valueOf(600)); assertEquals(cmd.parameters.size(), 3); assertEquals(cmd.parameters.get(0), "extra"); assertEquals(cmd.parameters.get(1), "other"); @@ -84,7 +83,7 @@ public void positional_args_03() { assertEquals(cmd.file, "example.txt"); assertEquals(cmd.otherFile, "example.txt"); assertEquals(cmd.file, cmd.otherFile); - assertEquals(cmd.mode, new Integer(600)); + assertEquals(cmd.mode, Integer.valueOf(600)); assertEquals(cmd.parameters.size(), 1); assertEquals(cmd.parameters.get(0), "extra"); } @@ -110,7 +109,7 @@ public void positional_args_04() { ArgsPositional cmd = parser.parse("example.txt", "600", "extra"); assertEquals(cmd.file, "example.txt"); - assertEquals(cmd.mode, new Integer(600)); + assertEquals(cmd.mode, Integer.valueOf(600)); assertEquals(cmd.parameters.size(), 1); assertEquals(cmd.parameters.get(0), "extra"); } @@ -123,7 +122,7 @@ public void positional_args_05() { ArgsPositionalNoExtras cmd = parser.parse("example.txt", "600"); assertEquals(cmd.file, "example.txt"); - assertEquals(cmd.mode, new Integer(600)); + assertEquals(cmd.mode, Integer.valueOf(600)); } @Test(expectedExceptions = ParseArgumentsUnexpectedException.class) @@ -134,7 +133,7 @@ public void positional_args_06() { ArgsPositionalNoExtras cmd = parser.parse("example.txt", "600", "extra"); assertEquals(cmd.file, "example.txt"); - assertEquals(cmd.mode, new Integer(600)); + assertEquals(cmd.mode, Integer.valueOf(600)); } @Test(expectedExceptions = IllegalStateException.class) diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/parser/TestOptionParsing.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/parser/TestOptionParsing.java index f74e29b4e..08ca3d0f5 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/parser/TestOptionParsing.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/parser/TestOptionParsing.java @@ -384,9 +384,9 @@ private CommandLineInterface createMaybeListValueParser(Class Cli createGreedyMaybeListValueParser(Class cls, char listSeparator) { + private CommandLineInterface createGreedyMaybeListValueParser(Class cls, char listSeparator) { //@formatter:off - CliBuilder builder = Cli.builder("test") + CliBuilder builder = CommandLineInterface.builder("test") .withCommand(cls); builder.withParser() .withOptionParser(new GreedyMaybeListValueOptionParser(listSeparator)); @@ -616,61 +616,61 @@ public void option_parsing_maybe_list_value_15() { @Test(expectedExceptions = ParseOptionMissingValueException.class, expectedExceptionsMessageRegExp = "Required values.*") public void option_parsing_greedy_maybe_list_value_bad_01() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); testParsing(parser, "OptionParsing1", "-c"); } @Test(expectedExceptions = ParseOptionMissingValueException.class, expectedExceptionsMessageRegExp = "Too few.*") public void option_parsing_greedy_maybe_list_value_bad_02() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); testParsing(parser, "OptionParsing1", "-c", "one"); } @Test(expectedExceptions = ParseOptionUnexpectedException.class, expectedExceptionsMessageRegExp = "Too many.*") public void option_parsing_greedy_maybe_list_value_bad_03() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); testParsing(parser, "OptionParsing1", "-c", "one,two,three"); } @Test(expectedExceptions = ParseOptionMissingValueException.class, expectedExceptionsMessageRegExp = "Too few.*") public void option_parsing_greedy_maybe_list_value_bad_04() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); testParsing(parser, "OptionParsing1", "-cone"); } @Test(expectedExceptions = ParseOptionUnexpectedException.class, expectedExceptionsMessageRegExp = "Too many.*") public void option_parsing_greedy_maybe_list_value_bad_05() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); testParsing(parser, "OptionParsing1", "-cone,two,three"); } @Test(expectedExceptions = ParseOptionUnexpectedException.class, expectedExceptionsMessageRegExp = "Too many.*") public void option_parsing_greedy_maybe_list_value_bad_06() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); testParsing(parser, "OptionParsing1", "-c", "one", "two", "three"); } @Test(expectedExceptions = ParseOptionUnexpectedException.class, expectedExceptionsMessageRegExp = "Too many.*") public void option_parsing_greedy_maybe_list_value_bad_07() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); testParsing(parser, "OptionParsing1", "-c", "one", "two", "three", "-a"); } @Test(expectedExceptions = ParseOptionUnexpectedException.class, expectedExceptionsMessageRegExp = "Too many.*") public void option_parsing_greedy_maybe_list_value_bad_08() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); testParsing(parser, "OptionParsing1", "-c", "one", "two", "three", "-afoo"); } @Test(expectedExceptions = ParseOptionUnexpectedException.class, expectedExceptionsMessageRegExp = "Too many.*") public void option_parsing_greedy_maybe_list_value_bad_09() { - Cli parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); testParsing(parser, "OptionParsing1", "-c", "one", "two,three", "--", "foo"); } @Test public void option_parsing_greedy_maybe_list_value_01() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-b", "foo"); Assert.assertEquals(cmd.beta, "foo"); @@ -678,7 +678,7 @@ public void option_parsing_greedy_maybe_list_value_01() { @Test public void option_parsing_greedy_maybe_list_value_02() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-bfoo"); Assert.assertEquals(cmd.beta, "foo"); @@ -686,7 +686,7 @@ public void option_parsing_greedy_maybe_list_value_02() { @Test public void option_parsing_greedy_maybe_list_value_03() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one,two"); Assert.assertEquals(cmd.charlie.size(), 2); @@ -696,7 +696,7 @@ public void option_parsing_greedy_maybe_list_value_03() { @Test public void option_parsing_greedy_maybe_list_value_04() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-cone,two"); Assert.assertEquals(cmd.charlie.size(), 2); @@ -706,7 +706,7 @@ public void option_parsing_greedy_maybe_list_value_04() { @Test public void option_parsing_greedy_maybe_list_value_05() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-b", "foo,bar"); Assert.assertEquals(cmd.beta, "bar"); @@ -714,7 +714,7 @@ public void option_parsing_greedy_maybe_list_value_05() { @Test public void option_parsing_greedy_maybe_list_value_06() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-cone,two,three,four"); Assert.assertEquals(cmd.charlie.size(), 4); @@ -726,7 +726,7 @@ public void option_parsing_greedy_maybe_list_value_06() { @Test public void option_parsing_greedy_maybe_list_value_07() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-cone", "two", "three,four"); Assert.assertEquals(cmd.charlie.size(), 4); @@ -738,7 +738,7 @@ public void option_parsing_greedy_maybe_list_value_07() { @Test public void option_parsing_greedy_maybe_list_value_08() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one,two", "three,four"); Assert.assertEquals(cmd.charlie.size(), 4); @@ -750,7 +750,7 @@ public void option_parsing_greedy_maybe_list_value_08() { @Test public void option_parsing_greedy_maybe_list_value_09() { - Cli parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionParsing.class, ','); OptionParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one,two", "three", "four"); Assert.assertEquals(cmd.charlie.size(), 4); @@ -762,7 +762,7 @@ public void option_parsing_greedy_maybe_list_value_09() { @Test public void option_parsing_greedy_maybe_list_value_10() { - Cli parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); OptionAndArgumentParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one,two", "three", "four"); Assert.assertEquals(cmd.charlie.size(), 4); @@ -774,7 +774,7 @@ public void option_parsing_greedy_maybe_list_value_10() { @Test public void option_parsing_greedy_maybe_list_value_11() { - Cli parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); OptionAndArgumentParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one", "two,three", "four"); Assert.assertEquals(cmd.charlie.size(), 4); @@ -786,7 +786,7 @@ public void option_parsing_greedy_maybe_list_value_11() { @Test public void option_parsing_greedy_maybe_list_value_12() { - Cli parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); OptionAndArgumentParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one", "two", "three", "four"); Assert.assertEquals(cmd.charlie.size(), 4); @@ -798,7 +798,7 @@ public void option_parsing_greedy_maybe_list_value_12() { @Test public void option_parsing_greedy_maybe_list_value_13() { - Cli parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionAndArgumentParsing.class, ','); OptionAndArgumentParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one", "two", "--", "three", "four"); Assert.assertEquals(cmd.charlie.size(), 2); @@ -811,7 +811,7 @@ public void option_parsing_greedy_maybe_list_value_13() { @Test public void option_parsing_greedy_maybe_list_value_14() { - Cli parser = createGreedyMaybeListValueParser(OptionAndDefaultParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionAndDefaultParsing.class, ','); OptionAndDefaultParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one", "two", "three", "four"); Assert.assertEquals(cmd.charlie.size(), 4); @@ -823,7 +823,7 @@ public void option_parsing_greedy_maybe_list_value_14() { @Test public void option_parsing_greedy_maybe_list_value_15() { - Cli parser = createGreedyMaybeListValueParser(OptionAndDefaultParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionAndDefaultParsing.class, ','); OptionAndDefaultParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one", "two", "-b", "three", "four"); Assert.assertEquals(cmd.charlie.size(), 2); @@ -834,7 +834,7 @@ public void option_parsing_greedy_maybe_list_value_15() { @Test public void option_parsing_greedy_maybe_list_value_16() { - Cli parser = createGreedyMaybeListValueParser(OptionAndDefaultParsing.class, ','); + CommandLineInterface parser = createGreedyMaybeListValueParser(OptionAndDefaultParsing.class, ','); OptionAndDefaultParsing cmd = testParsing(parser, "OptionParsing1", "-c", "one", "two", "-b", "three", "-d", "four"); Assert.assertEquals(cmd.charlie.size(), 2); diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/parser/aliases/TestAliases.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/parser/aliases/TestAliases.java index 2a0228220..f280b4472 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/parser/aliases/TestAliases.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/parser/aliases/TestAliases.java @@ -15,9 +15,7 @@ */ package com.github.rvesse.airline.tests.parser.aliases; -import com.github.rvesse.airline.Cli; -import com.github.rvesse.airline.parser.resources.ModulePathLocator; -import com.github.rvesse.airline.tests.args.Args1; +import com.github.rvesse.airline.CommandLineInterface; import com.github.rvesse.airline.builder.CliBuilder; import com.github.rvesse.airline.help.cli.CliGlobalUsageGenerator; import com.github.rvesse.airline.model.AliasMetadata; @@ -27,6 +25,8 @@ import com.github.rvesse.airline.parser.resources.ClasspathLocator; import com.github.rvesse.airline.parser.resources.EnvVarLocator; import com.github.rvesse.airline.parser.resources.JvmSystemPropertyLocator; +import com.github.rvesse.airline.parser.resources.ModulePathLocator; +import com.github.rvesse.airline.tests.args.Args1; import org.apache.commons.lang3.StringUtils; import org.testng.Assert; import org.testng.SkipException; @@ -46,24 +46,6 @@ import java.util.List; import java.util.Map; -import org.apache.commons.lang3.StringUtils; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.github.rvesse.airline.CommandLineInterface; -import com.github.rvesse.airline.args.Args1; -import com.github.rvesse.airline.builder.CliBuilder; -import com.github.rvesse.airline.help.cli.CliGlobalUsageGenerator; -import com.github.rvesse.airline.model.AliasMetadata; -import com.github.rvesse.airline.parser.errors.ParseAliasCircularReferenceException; -import com.github.rvesse.airline.parser.errors.ParseCommandUnrecognizedException; -import com.github.rvesse.airline.parser.errors.ParseOptionConversionException; -import com.github.rvesse.airline.parser.resources.ClasspathLocator; -import com.github.rvesse.airline.parser.resources.EnvVarLocator; -import com.github.rvesse.airline.parser.resources.JvmSystemPropertyLocator; - public class TestAliases { private static final File f = new File("target/test.config"); @@ -638,7 +620,7 @@ public void user_aliases_classpath_01() throws Exception { builder.withParser() .withUserAliases() .withFilename("aliases.config") - .withSearchLocation("/") + .withSearchLocation("/com/github/rvesse/airline/tests/") .withLocators(new ClasspathLocator(), new ModulePathLocator()); CommandLineInterface cli = builder.build(); //@formatter:on @@ -668,7 +650,7 @@ public void user_aliases_classpath_02() throws Exception { builder.withParser() .withUserAliases() .withFilename("aliases.config") - .withSearchLocation("classpath:/") + .withSearchLocation("classpath:/com/github/rvesse/airline/tests/") .withLocators(new ClasspathLocator(), new ModulePathLocator()); CommandLineInterface cli = builder.build(); //@formatter:on diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/sections/TestHelpSectionDetection.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/sections/TestHelpSectionDetection.java index 3e734bf01..cb07d7fb2 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/sections/TestHelpSectionDetection.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/sections/TestHelpSectionDetection.java @@ -58,7 +58,7 @@ public CommandMetadata loadCommand() { public CommandMetadata loadCommand(final String commandName) { CommandFinder finder = new CommandFinder(commandName); - Cli cli = new Cli<>(CliWithSections.class); + CommandLineInterface cli = new CommandLineInterface<>(CliWithSections.class); CommandMetadata cmd = IterableUtils.find(cli.getMetadata().getDefaultGroupCommands(), finder); Assert.assertNotNull(cmd, "Failed to find expected command " + commandName); return cmd; @@ -68,7 +68,7 @@ public CommandMetadata loadCommand(final String commandName) { public void help_section_cli_01() { CommandMetadata cmd = loadCommand(); - HelpSection section = CollectionUtils.find(cmd.getHelpSections(), + HelpSection section = IterableUtils.find(cmd.getHelpSections(), new HelpSectionFinder(CommonSections.TITLE_DISCUSSION)); Assert.assertTrue(section instanceof DiscussionSection); DiscussionSection discussion = (DiscussionSection) section; @@ -82,7 +82,7 @@ public void help_section_cli_01() { public void help_section_cli_02() { CommandMetadata cmd = loadCommand("remove"); - HelpSection section = CollectionUtils.find(cmd.getHelpSections(), + HelpSection section = IterableUtils.find(cmd.getHelpSections(), new HelpSectionFinder(CommonSections.TITLE_DISCUSSION)); Assert.assertTrue(section instanceof DiscussionSection); DiscussionSection discussion = (DiscussionSection) section; @@ -94,7 +94,7 @@ public void help_section_cli_02() { public void help_section_cli_03() { CommandMetadata cmd = loadCommand("remove"); - HelpSection section = CollectionUtils.find(cmd.getHelpSections(), + HelpSection section = IterableUtils.find(cmd.getHelpSections(), new HelpSectionFinder(CommonSections.TITLE_SEE_ALSO)); Assert.assertTrue(section instanceof ProseSection); ProseSection prose = (ProseSection) section; diff --git a/airline-core/src/test/java/com/github/rvesse/airline/tests/utils/ComparatorTests.java b/airline-core/src/test/java/com/github/rvesse/airline/tests/utils/ComparatorTests.java index 6ca56b9c0..9f2586fc5 100644 --- a/airline-core/src/test/java/com/github/rvesse/airline/tests/utils/ComparatorTests.java +++ b/airline-core/src/test/java/com/github/rvesse/airline/tests/utils/ComparatorTests.java @@ -31,7 +31,7 @@ public void float_comparator_negatives_01() { FloatComparator comparator = new FloatComparator(); Assert.assertTrue(-1f < 0f); - Assert.assertTrue(new Float(-1f) < new Float(0f)); + Assert.assertTrue(Float.valueOf(-1f) < Float.valueOf(0f)); Assert.assertEquals(comparator.compare(-1f, 0f), -1); } @@ -40,7 +40,7 @@ public void float_comparator_positives_01() { FloatComparator comparator = new FloatComparator(); Assert.assertTrue(1f > 0f); - Assert.assertTrue(new Float(1f) > new Float(0f)); + Assert.assertTrue(Float.valueOf(1f) > Float.valueOf(0f)); Assert.assertEquals(comparator.compare(1f, 0f), 1); } @@ -62,7 +62,7 @@ public void double_comparator_negatives_01() { DoubleComparator comparator = new DoubleComparator(); Assert.assertTrue(-1d < 0d); - Assert.assertTrue(new Double(-1d) < new Double(0d)); + Assert.assertTrue(Double.valueOf(-1d) < Double.valueOf(0d)); Assert.assertEquals(comparator.compare(-1d, 0d), -1); } @@ -71,7 +71,7 @@ public void double_comparator_positives_01() { DoubleComparator comparator = new DoubleComparator(); Assert.assertTrue(1d > 0d); - Assert.assertTrue(new Double(1d) > new Double(0d)); + Assert.assertTrue(Double.valueOf(1d) > Double.valueOf(0d)); Assert.assertEquals(comparator.compare(1d, 0d), 1); } diff --git a/airline-core/src/test/java/module-info.java b/airline-core/src/test/java/module-info.java index a6a562b84..eb3ae60f4 100644 --- a/airline-core/src/test/java/module-info.java +++ b/airline-core/src/test/java/module-info.java @@ -44,6 +44,7 @@ opens com.github.rvesse.airline.tests; opens com.github.rvesse.airline.tests.args; opens com.github.rvesse.airline.tests.args.overrides; + opens com.github.rvesse.airline.tests.args.positional; opens com.github.rvesse.airline.tests.parser; opens com.github.rvesse.airline.tests.restrictions; opens com.github.rvesse.airline.tests.restrictions.partial; diff --git a/airline-help/airline-help-man/src/test/java/com/github/rvesse/airline/help/man/ArgsManPositionalArgs.java b/airline-help/airline-help-man/src/test/java/com/github/rvesse/airline/help/man/tests/ArgsManPositionalArgs.java similarity index 96% rename from airline-help/airline-help-man/src/test/java/com/github/rvesse/airline/help/man/ArgsManPositionalArgs.java rename to airline-help/airline-help-man/src/test/java/com/github/rvesse/airline/help/man/tests/ArgsManPositionalArgs.java index b7e91495c..ee68c0f16 100644 --- a/airline-help/airline-help-man/src/test/java/com/github/rvesse/airline/help/man/ArgsManPositionalArgs.java +++ b/airline-help/airline-help-man/src/test/java/com/github/rvesse/airline/help/man/tests/ArgsManPositionalArgs.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.rvesse.airline.help.man; +package com.github.rvesse.airline.help.man.tests; import java.util.List;