summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/beust/jcommander/args
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/beust/jcommander/args')
-rw-r--r--src/test/java/com/beust/jcommander/args/AlternateNamesForListArgs.java32
-rw-r--r--src/test/java/com/beust/jcommander/args/Args1.java56
-rw-r--r--src/test/java/com/beust/jcommander/args/Args1Setter.java93
-rw-r--r--src/test/java/com/beust/jcommander/args/Args2.java42
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsArityInteger.java37
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsArityString.java37
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsBooleanArity.java26
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsBooleanArity0.java26
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsConverter.java57
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsConverterFactory.java28
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsDefault.java43
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsEnum.java55
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsEquals.java11
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsHelp.java30
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsI18N1.java27
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsI18N2.java30
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsI18N2New.java34
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsInherited.java28
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsList.java49
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsLongDescription.java25
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsMainParameter1.java40
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsMainParameter2.java41
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsMaster.java31
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsMultipleUnparsed.java35
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsOutOfMemory.java13
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsPassword.java26
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsPrivate.java30
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsRequired.java31
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsSlave.java31
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsSlaveBogus.java31
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsValidate1.java10
-rw-r--r--src/test/java/com/beust/jcommander/args/ArgsWithSet.java11
-rw-r--r--src/test/java/com/beust/jcommander/args/Arity1.java9
-rw-r--r--src/test/java/com/beust/jcommander/args/CommandLineArgs.java120
-rw-r--r--src/test/java/com/beust/jcommander/args/CommandLineArgs2.java72
-rw-r--r--src/test/java/com/beust/jcommander/args/IHostPorts.java27
-rw-r--r--src/test/java/com/beust/jcommander/args/SeparatorColon.java29
-rw-r--r--src/test/java/com/beust/jcommander/args/SeparatorEqual.java32
-rw-r--r--src/test/java/com/beust/jcommander/args/SeparatorMixed.java32
-rw-r--r--src/test/java/com/beust/jcommander/args/SlashSeparator.java32
-rw-r--r--src/test/java/com/beust/jcommander/args/VariableArity.java26
41 files changed, 1475 insertions, 0 deletions
diff --git a/src/test/java/com/beust/jcommander/args/AlternateNamesForListArgs.java b/src/test/java/com/beust/jcommander/args/AlternateNamesForListArgs.java
new file mode 100644
index 0000000..18a1655
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/AlternateNamesForListArgs.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.internal.Lists;
+import java.util.List;
+
+/**
+ *
+ * @author Andy Law <andy.law@roslin.ed.ac.uk>
+ */
+public class AlternateNamesForListArgs {
+
+ @Parameter(names = {"-s", "--servers"}, description = "blah")
+ public List<String> serverNames = Lists.newLinkedList();
+}
diff --git a/src/test/java/com/beust/jcommander/args/Args1.java b/src/test/java/com/beust/jcommander/args/Args1.java
new file mode 100644
index 0000000..093abec
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/Args1.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+import org.testng.collections.Lists;
+
+import com.beust.jcommander.Parameter;
+
+public class Args1 {
+ @Parameter
+ public List<String> parameters = Lists.newArrayList();
+
+ @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity", required = true)
+ public Integer verbose = 1;
+
+ @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
+ public String groups;
+
+ @Parameter(names = "-debug", description = "Debug mode")
+ public boolean debug = false;
+
+ @Parameter(names = "-long", description = "A long number")
+ public long l;
+
+ @Parameter(names = "-double", description = "A double number")
+ public double doub;
+
+ @Parameter(names = "-float", description = "A float number")
+ public float floa;
+
+ @Parameter(names = "-bigdecimal", description = "A BigDecimal number")
+ public BigDecimal bigd;
+
+ @Parameter(names = "-date", description = "An ISO 8601 formatted date.")
+ public Date date;
+}
diff --git a/src/test/java/com/beust/jcommander/args/Args1Setter.java b/src/test/java/com/beust/jcommander/args/Args1Setter.java
new file mode 100644
index 0000000..10f9ef3
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/Args1Setter.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.internal.Lists;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+public class Args1Setter {
+ @Parameter
+ public void setParameters(List<String> p) {
+ parameters = p;
+ }
+
+ public List<String> getParameters() {
+ return this.parameters;
+ }
+ public List<String> parameters = Lists.newArrayList();
+
+ @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity", required = true)
+ public void setVerbose(Integer v) {
+ verbose = v;
+ }
+ public Integer verbose = 1;
+
+ @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
+ public void setGroups(String g) {
+ groups = g;
+ }
+
+ public String groups;
+
+ @Parameter(names = "-debug", description = "Debug mode")
+ public void setDebug(boolean d) {
+ debug = d;
+ }
+
+ public boolean debug = false;
+
+ @Parameter(names = "-long", description = "A long number")
+ public void setLong(long ll) {
+ l = ll;
+ }
+
+ public long l;
+
+ @Parameter(names = "-double", description = "A double number")
+ public void setDouble(double d) {
+ doub = d;
+ }
+
+ public double doub;
+
+ @Parameter(names = "-float", description = "A float number")
+ public void setFloat(float f) {
+ floa = f;
+ }
+
+ public float floa;
+
+ @Parameter(names = "-bigdecimal", description = "A BigDecimal number")
+ public void setBigDecimal(BigDecimal bd) {
+ bigd = bd;
+ }
+
+ public BigDecimal bigd;
+
+ @Parameter(names = "-date", description = "An ISO 8601 formatted date.")
+ public void setDate(Date d) {
+ date = d;
+ }
+
+ public Date date;
+}
diff --git a/src/test/java/com/beust/jcommander/args/Args2.java b/src/test/java/com/beust/jcommander/args/Args2.java
new file mode 100644
index 0000000..89f622b
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/Args2.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.internal.Lists;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Args2 {
+ @Parameter(description = "List of parameters")
+ public List parameters = Lists.newArrayList();
+
+ @Parameter(names = {"-log", "-verbose"}, description = "Level of verbosity")
+ public Integer verbose = 1;
+
+ @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
+ public String groups;
+
+ @Parameter(names = "-debug", description = "Debug mode")
+ public boolean debug = false;
+
+ @Parameter(names = "-host", description = "The host")
+ public List hosts = new ArrayList();
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsArityInteger.java b/src/test/java/com/beust/jcommander/args/ArgsArityInteger.java
new file mode 100644
index 0000000..9c1611f
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsArityInteger.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+import java.util.List;
+
+/**
+ * Test parameter arity.
+ *
+ * @author cbeust
+ */
+public class ArgsArityInteger {
+
+ @Parameter(names = "-pairs", arity = 2, description = "Pairs")
+ public List<Integer> pairs;
+
+ @Parameter(description = "Rest")
+ public List<String> rest;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsArityString.java b/src/test/java/com/beust/jcommander/args/ArgsArityString.java
new file mode 100644
index 0000000..056ae85
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsArityString.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+import java.util.List;
+
+/**
+ * Test parameter arity.
+ *
+ * @author cbeust
+ */
+public class ArgsArityString {
+
+ @Parameter(names = "-pairs", arity = 2, description = "Pairs")
+ public List<String> pairs;
+
+ @Parameter(description = "Rest")
+ public List<String> rest;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsBooleanArity.java b/src/test/java/com/beust/jcommander/args/ArgsBooleanArity.java
new file mode 100644
index 0000000..242e347
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsBooleanArity.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class ArgsBooleanArity {
+ @Parameter(names = "-debug", arity = 1)
+ public Boolean debug = false;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsBooleanArity0.java b/src/test/java/com/beust/jcommander/args/ArgsBooleanArity0.java
new file mode 100644
index 0000000..62895ec
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsBooleanArity0.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class ArgsBooleanArity0 {
+ @Parameter(names = "-debug", arity = 0)
+ public Boolean debug = false;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsConverter.java b/src/test/java/com/beust/jcommander/args/ArgsConverter.java
new file mode 100644
index 0000000..677cf9b
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsConverter.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.converters.FileConverter;
+import com.beust.jcommander.converters.PathConverter;
+import com.beust.jcommander.converters.URIConverter;
+import com.beust.jcommander.converters.URLConverter;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URL;
+import java.nio.file.Path;
+import java.util.List;
+
+public class ArgsConverter {
+
+ @Parameter(names = "-file", converter = FileConverter.class)
+ public File file;
+
+ @Parameter(names = "-url", converter = URLConverter.class)
+ public URL url;
+
+ @Parameter(names = "-uri", converter = URIConverter.class)
+ public URI uri;
+
+ @Parameter(names = "-path", converter = PathConverter.class)
+ public Path path;
+
+ @Parameter(names = "-listStrings")
+ public List<String> listStrings;
+
+ @Parameter(names = "-listInts")
+ public List<Integer> listInts;
+
+ @Parameter(names = "-listBigDecimals")
+ public List<BigDecimal> listBigDecimals;
+
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsConverterFactory.java b/src/test/java/com/beust/jcommander/args/ArgsConverterFactory.java
new file mode 100644
index 0000000..f8463a0
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsConverterFactory.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.HostPort;
+import com.beust.jcommander.Parameter;
+
+public class ArgsConverterFactory {
+
+ @Parameter(names = "-hostport")
+ public HostPort hostPort;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsDefault.java b/src/test/java/com/beust/jcommander/args/ArgsDefault.java
new file mode 100644
index 0000000..1adcd73
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsDefault.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+import org.testng.collections.Lists;
+
+import java.util.List;
+
+public class ArgsDefault {
+ @Parameter
+ public List<String> parameters = Lists.newArrayList();
+
+ @Parameter(names = "-log", description = "Level of verbosity")
+ public Integer log = 1;
+
+ @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
+ public String groups;
+
+ @Parameter(names = "-debug", description = "Debug mode")
+ public boolean debug = false;
+
+ @Parameter(names = "-level", description = "A long number")
+ public long level;
+
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsEnum.java b/src/test/java/com/beust/jcommander/args/ArgsEnum.java
new file mode 100644
index 0000000..bef663b
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsEnum.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
+import org.testng.Assert;
+
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+
+/**
+ * Test enums.
+ *
+ * @author Adrian Muraru
+ */
+public class ArgsEnum {
+
+ public enum ChoiceType { ONE, Two, THREE };
+ @Parameter(names = "-choice")
+ public ChoiceType choice = ChoiceType.ONE;
+
+ @Parameter(names = "-choices", variableArity = true)
+ public List<ChoiceType> choices = new ArrayList<ChoiceType>();
+
+ public static void main(String[] args1) {
+ ArgsEnum args = new ArgsEnum();
+ String[] argv = { "-choice", "ONE"};
+ JCommander jc = new JCommander(args, argv);
+ jc.usage();
+ Assert.assertEquals(jc.getParameters().get(0).getDescription(),
+ "Options: " + EnumSet.allOf((Class<? extends Enum>) ArgsEnum.ChoiceType.class));
+ }
+
+}
+
+
diff --git a/src/test/java/com/beust/jcommander/args/ArgsEquals.java b/src/test/java/com/beust/jcommander/args/ArgsEquals.java
new file mode 100644
index 0000000..016166d
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsEquals.java
@@ -0,0 +1,11 @@
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+
+@Parameters(separators = "=")
+public class ArgsEquals {
+
+ @Parameter(names = "-args")
+ public String args;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsHelp.java b/src/test/java/com/beust/jcommander/args/ArgsHelp.java
new file mode 100644
index 0000000..4baaddd
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsHelp.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * Test a help option which overrides other options and option validations
+ */
+public class ArgsHelp {
+
+ @Parameter(names = "-h", description = "Display help")
+ public boolean help;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsI18N1.java b/src/test/java/com/beust/jcommander/args/ArgsI18N1.java
new file mode 100644
index 0000000..80e29e2
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsI18N1.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class ArgsI18N1 {
+
+ @Parameter(names = "-host", description = "Host", descriptionKey = "host")
+ String hostName;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsI18N2.java b/src/test/java/com/beust/jcommander/args/ArgsI18N2.java
new file mode 100644
index 0000000..1ccfd43
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsI18N2.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.ResourceBundle;
+
+@SuppressWarnings("deprecation")
+@ResourceBundle("MessageBundle")
+public class ArgsI18N2 {
+
+ @Parameter(names = "-host", description = "Host", descriptionKey = "host")
+ String hostName;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsI18N2New.java b/src/test/java/com/beust/jcommander/args/ArgsI18N2New.java
new file mode 100644
index 0000000..c760973
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsI18N2New.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+
+import java.util.List;
+
+@Parameters(resourceBundle = "MessageBundle")
+public class ArgsI18N2New {
+
+ @Parameter(names = "-host", description = "Host", descriptionKey = "host")
+ String hostName;
+
+ @Parameter(descriptionKey = "files")
+ List<String> files;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsInherited.java b/src/test/java/com/beust/jcommander/args/ArgsInherited.java
new file mode 100644
index 0000000..abc0e82
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsInherited.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class ArgsInherited extends ArgsDefault {
+
+ @Parameter(names = "-child", description = "Child parameter")
+ public Integer child = 1;
+
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsList.java b/src/test/java/com/beust/jcommander/args/ArgsList.java
new file mode 100644
index 0000000..e827773
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsList.java
@@ -0,0 +1,49 @@
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.HostPort;
+import com.beust.jcommander.HostPortConverter;
+import com.beust.jcommander.IStringConverter;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.converters.IParameterSplitter;
+
+import org.testng.collections.Lists;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class ArgsList {
+ @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
+ public List<String> groups;
+
+ @Parameter(names = "-ints")
+ public List<Integer> ints;
+
+ @Parameter(names = "-hp", converter = HostPortConverter.class, splitter = SemiColonSplitter.class)
+ public List<HostPort> hostPorts;
+
+ @Parameter(names = "-hp2", converter = HostPortConverter.class)
+ public List<HostPort> hp2;
+
+ @Parameter(names = "-uppercase", listConverter = UppercaseConverter.class)
+ public List<String> uppercase;
+
+ public static class UppercaseConverter implements IStringConverter<List<String>> {
+ public List<String> convert(String value) {
+ List<String> result = Lists.newArrayList();
+ String[] s = value.split(",");
+ for (String p : s) {
+ result.add(p.toUpperCase());
+ }
+ return result;
+ }
+ }
+
+ public static class SemiColonSplitter implements IParameterSplitter {
+
+ public List<String> split(String value) {
+ return Arrays.asList(value.split(";"));
+ }
+
+ }
+
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsLongDescription.java b/src/test/java/com/beust/jcommander/args/ArgsLongDescription.java
new file mode 100644
index 0000000..e961016
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsLongDescription.java
@@ -0,0 +1,25 @@
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class ArgsLongDescription {
+
+ @Parameter(names = "--classpath", description = "The classpath. This is a very long "
+ + "description in order to test the line wrapping. Let's see how this works."
+ + "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
+ + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis "
+ + "nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")
+ public String classpath = "/tmp";
+
+ @Parameter(names = { "-c", "--convention" }, description = "The convention", required = true)
+ public String convention = "Java";
+
+ @Parameter(names = { "-d", "--destination" }, description = "The destination to go to")
+ public String destination;
+
+ @Parameter(names = "--configure", description = "How to configure")
+ public String configure;
+
+ @Parameter(names = "--filespec")
+ public String filespec;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsMainParameter1.java b/src/test/java/com/beust/jcommander/args/ArgsMainParameter1.java
new file mode 100644
index 0000000..cd5c52d
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsMainParameter1.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.HostPort;
+import com.beust.jcommander.Parameter;
+
+import org.testng.collections.Lists;
+
+import java.util.List;
+
+/**
+ * A class with main parameter that is not a List<String>
+ *
+ * @author cbeust
+ */
+public class ArgsMainParameter1 implements IHostPorts {
+ @Parameter
+ public List<HostPort> parameters = Lists.newArrayList();
+
+ public List<HostPort> getHostPorts() {
+ return parameters;
+ }
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsMainParameter2.java b/src/test/java/com/beust/jcommander/args/ArgsMainParameter2.java
new file mode 100644
index 0000000..57422e3
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsMainParameter2.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.HostPort;
+import com.beust.jcommander.HostPortConverter;
+import com.beust.jcommander.Parameter;
+
+import org.testng.collections.Lists;
+
+import java.util.List;
+
+/**
+ * A class with main parameter that is not a List<String>
+ *
+ * @author cbeust
+ */
+public class ArgsMainParameter2 implements IHostPorts {
+ @Parameter(converter = HostPortConverter.class)
+ public List<HostPort> parameters = Lists.newArrayList();
+
+ public List<HostPort> getHostPorts() {
+ return parameters;
+ }
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsMaster.java b/src/test/java/com/beust/jcommander/args/ArgsMaster.java
new file mode 100644
index 0000000..ebcba67
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsMaster.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * Test multi-object parsing, along with ArgsSlave.
+ *
+ * @author cbeust
+ */
+public class ArgsMaster {
+ @Parameter(names = "-master")
+ public String master;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsMultipleUnparsed.java b/src/test/java/com/beust/jcommander/args/ArgsMultipleUnparsed.java
new file mode 100644
index 0000000..f7b0628
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsMultipleUnparsed.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * Error case if multiple unparsed (without a names attribute) arguments are defined.
+ *
+ * @author cbeust
+ */
+public class ArgsMultipleUnparsed {
+
+ @Parameter(description = "Bogus1")
+ public String unparsed1;
+
+ @Parameter(description = "Bogus2")
+ public String unparsed2;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsOutOfMemory.java b/src/test/java/com/beust/jcommander/args/ArgsOutOfMemory.java
new file mode 100644
index 0000000..f059ebb
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsOutOfMemory.java
@@ -0,0 +1,13 @@
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class ArgsOutOfMemory
+{
+ @Parameter(names = { "-p", "--pattern" },
+ description = "pattern used by 'tail'. See http://logback.qos.ch/manual/layouts.html#ClassicPatternLayout and http://logback.qos.ch/manual/layouts.html#AccessPatternLayout")
+ public String pattern;
+
+ @Parameter(names = "-q", description = "Filler arg")
+ public String filler;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsPassword.java b/src/test/java/com/beust/jcommander/args/ArgsPassword.java
new file mode 100644
index 0000000..06c468e
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsPassword.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class ArgsPassword {
+ @Parameter(names = "-password", description = "Connection password", password = true)
+ public String password;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsPrivate.java b/src/test/java/com/beust/jcommander/args/ArgsPrivate.java
new file mode 100644
index 0000000..16e4b4e
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsPrivate.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class ArgsPrivate {
+ @Parameter(names = "-verbose")
+ private Integer verbose = 1;
+
+ public Integer getVerbose() {
+ return verbose;
+ }
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsRequired.java b/src/test/java/com/beust/jcommander/args/ArgsRequired.java
new file mode 100644
index 0000000..69cb814
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsRequired.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.internal.Lists;
+
+import java.util.List;
+
+public class ArgsRequired {
+
+ @Parameter(description = "List of files", required = true)
+ public List<String> parameters = Lists.newArrayList();
+
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsSlave.java b/src/test/java/com/beust/jcommander/args/ArgsSlave.java
new file mode 100644
index 0000000..dabeb57
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsSlave.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * Test multi-object parsing, along with ArgsSlave.
+ *
+ * @author cbeust
+ */
+public class ArgsSlave {
+ @Parameter(names = "-slave")
+ public String slave;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsSlaveBogus.java b/src/test/java/com/beust/jcommander/args/ArgsSlaveBogus.java
new file mode 100644
index 0000000..1abdf1f
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsSlaveBogus.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * Same as ArgsMaster class, should cause an error.
+ *
+ * @author cbeust
+ */
+public class ArgsSlaveBogus extends ArgsSlave {
+ @Parameter(names = "-master")
+ public String master;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsValidate1.java b/src/test/java/com/beust/jcommander/args/ArgsValidate1.java
new file mode 100644
index 0000000..5274220
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsValidate1.java
@@ -0,0 +1,10 @@
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.validators.PositiveInteger;
+
+public class ArgsValidate1 {
+
+ @Parameter(names = "-age", validateWith = PositiveInteger.class)
+ public Integer age;
+}
diff --git a/src/test/java/com/beust/jcommander/args/ArgsWithSet.java b/src/test/java/com/beust/jcommander/args/ArgsWithSet.java
new file mode 100644
index 0000000..1e41cd3
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/ArgsWithSet.java
@@ -0,0 +1,11 @@
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.SetConverter;
+
+import java.util.SortedSet;
+
+public class ArgsWithSet {
+ @Parameter(names = "-s", converter = SetConverter.class)
+ public SortedSet<Integer> set;
+} \ No newline at end of file
diff --git a/src/test/java/com/beust/jcommander/args/Arity1.java b/src/test/java/com/beust/jcommander/args/Arity1.java
new file mode 100644
index 0000000..8cbf086
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/Arity1.java
@@ -0,0 +1,9 @@
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+
+public class Arity1
+{
+ @Parameter(arity = 1, names = "-inspect", description = "", required = false)
+ public boolean inspect;
+}
diff --git a/src/test/java/com/beust/jcommander/args/CommandLineArgs.java b/src/test/java/com/beust/jcommander/args/CommandLineArgs.java
new file mode 100644
index 0000000..7c8414f
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/CommandLineArgs.java
@@ -0,0 +1,120 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.internal.Lists;
+
+import java.util.List;
+
+public class CommandLineArgs {
+
+ @Parameter(description = "The XML suite files to run")
+ public List<String> suiteFiles = Lists.newArrayList();
+
+ @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity")
+ public Integer verbose;
+
+ @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
+ public String groups;
+
+ @Parameter(names = "-excludedgroups", description ="Comma-separated list of group names to be " +
+ "run")
+ public String excludedGroups;
+
+ @Parameter(names = "-d", description ="Output directory")
+ public String outputDirectory;
+
+ @Parameter(names = "-junit", description ="JUnit mode")
+ public Boolean junit = Boolean.FALSE;
+
+ @Parameter(names = "-listener", description = "List of .class files or list of class names" +
+ " implementing ITestListener or ISuiteListener")
+ public String listener;
+
+ @Parameter(names = "-methodselectors", description = "List of .class files or list of class " +
+ "names implementing IMethodSelector")
+ public String methodSelectors;
+
+ @Parameter(names = "-objectfactory", description = "List of .class files or list of class " +
+ "names implementing ITestRunnerFactory")
+ public String objectFactory;
+
+ @Parameter(names = "-parallel", description = "Parallel mode (methods, tests or classes)")
+ public String parallelMode;
+
+ @Parameter(names = "-configfailurepolicy", description = "Configuration failure policy (skip or continue)")
+ public String configFailurePolicy;
+
+ @Parameter(names = "-threadcount", description = "Number of threads to use when running tests " +
+ "in parallel")
+ public Integer threadCount;
+
+ @Parameter(names = "-dataproviderthreadcount", description = "Number of threads to use when " +
+ "running data providers")
+ public Integer dataProviderThreadCount;
+
+ @Parameter(names = "-suitename", description = "Default name of test suite, if not specified " +
+ "in suite definition file or source code")
+ public String suiteName;
+
+ @Parameter(names = "-testname", description = "Default name of test, if not specified in suite" +
+ "definition file or source code")
+ public String testName;
+
+ @Parameter(names = "-reporter", description = "Extended configuration for custom report listener")
+ public String reporter;
+
+ /**
+ * Used as map key for the complete list of report listeners provided with the above argument
+ */
+ @Parameter(names = "-reporterslist")
+ public String reportersList;
+
+ @Parameter(names = "-usedefaultlisteners", description = "Whether to use the default listeners")
+ public String useDefaultListeners = "true";
+
+ @Parameter(names = "-skipfailedinvocationcounts")
+ public Boolean skipFailedInvocationCounts;
+
+ @Parameter(names = "-testclass", description = "The list of test classes")
+ public String testClass;
+
+ @Parameter(names = "-testnames", description = "The list of test names to run")
+ public String testNames;
+
+ @Parameter(names = "-testjar", description = "")
+ public String testJar;
+
+ @Parameter(names = "-testRunFactory", description = "")
+ public String testRunFactory;
+
+ @Parameter(names = "-port", description = "The port")
+ public Integer port;
+
+ @Parameter(names = "-host", description = "The host")
+ public String host;
+
+ @Parameter(names = "-master", description ="Host where the master is")
+ public String master;
+
+ @Parameter(names = "-slave", description ="Host where the slave is")
+ public String slave;
+
+}
diff --git a/src/test/java/com/beust/jcommander/args/CommandLineArgs2.java b/src/test/java/com/beust/jcommander/args/CommandLineArgs2.java
new file mode 100644
index 0000000..ac62792
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/CommandLineArgs2.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.converters.FileConverter;
+
+import java.io.File;
+import java.util.List;
+
+public class CommandLineArgs2 {
+ @Parameter(description = "list of files")
+ List<String> list;
+
+ @Parameter(names = { "-v", "--verbose" }, description = "print verbose log messages.", arity = 1)
+ public boolean verbose = false;
+
+ @Parameter(names = { "-h", "--help" }, description = "show this help.")
+ public boolean showHelp = false;
+
+ @Parameter(names = { "-F", "--flush-preferences" }, description = "flush gui preferences.")
+ public boolean flushPreferences = false;
+
+ @Parameter(names = { "-L", "--flush-licensed" }, description = "flush licensed.")
+ public boolean flushLicensed = false;
+
+ @Parameter(names = { "-I", "--index-file" }, description = "indexes the given file.")
+ public Long indexFile;
+
+ @Parameter(names = { "-b", "--bonjour" }, description = "enable Bonjour.")
+ public boolean enableBonjour = false;
+
+ @Parameter(names = { "-m", "--md5" }, description = "create an MD5 checksum for the given file.", converter = FileConverter.class)
+ public File md5File;
+
+ @Parameter(names = { "-c", "--cat" }, description = "'cat' the given Lilith logfile.", converter = FileConverter.class)
+ public File catFile;
+
+ @Parameter(names = { "-t", "--tail" }, description = "'tail' the given Lilith logfile.", converter = FileConverter.class)
+ public File tailFile;
+
+ @Parameter(names = { "-p", "--pattern" }, description = "pattern used by 'cat' or 'tail'.")
+ public String pattern;
+
+ @Parameter(names = { "-f", "--keep-running" }, description = "keep tailing the given Lilith logfile.")
+ public boolean keepRunning = false;
+
+ @Parameter(names = { "-n", "--number-of-lines" }, description = "number of entries printed by cat or tail")
+ public Integer numberOfLines = -1;
+
+ @Parameter(names = { "-e", "--export-preferences" }, description = "export preferences into the given file.")
+ public String exportPreferencesFile;
+
+ @Parameter(names = { "-i", "--import-preferences" }, description = "import preferences from the given file.")
+ public String importPreferencesFile;
+}
diff --git a/src/test/java/com/beust/jcommander/args/IHostPorts.java b/src/test/java/com/beust/jcommander/args/IHostPorts.java
new file mode 100644
index 0000000..2020c77
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/IHostPorts.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.HostPort;
+
+import java.util.List;
+
+public interface IHostPorts {
+ List<HostPort> getHostPorts();
+}
diff --git a/src/test/java/com/beust/jcommander/args/SeparatorColon.java b/src/test/java/com/beust/jcommander/args/SeparatorColon.java
new file mode 100644
index 0000000..ab454fc
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/SeparatorColon.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+
+@Parameters(separators = ":")
+public class SeparatorColon {
+
+ @Parameter(names = "-verbose", arity = 1)
+ public boolean verbose = false;
+}
diff --git a/src/test/java/com/beust/jcommander/args/SeparatorEqual.java b/src/test/java/com/beust/jcommander/args/SeparatorEqual.java
new file mode 100644
index 0000000..a135207
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/SeparatorEqual.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+
+@Parameters(separators = "=")
+public class SeparatorEqual {
+
+ @Parameter(names = "-log")
+ public Integer log = 2;
+
+ @Parameter(names = "--longoption")
+ public Integer longOption;
+}
diff --git a/src/test/java/com/beust/jcommander/args/SeparatorMixed.java b/src/test/java/com/beust/jcommander/args/SeparatorMixed.java
new file mode 100644
index 0000000..aa2641f
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/SeparatorMixed.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+
+@Parameters(separators = ":=")
+public class SeparatorMixed {
+
+ @Parameter(names = "-level")
+ public Integer level = 0;
+
+ @Parameter(names = "-long")
+ public Long l = 0l;
+}
diff --git a/src/test/java/com/beust/jcommander/args/SlashSeparator.java b/src/test/java/com/beust/jcommander/args/SlashSeparator.java
new file mode 100644
index 0000000..64d3930
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/SlashSeparator.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2010 the original author or authors.
+ * See the notice.md file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+
+@Parameters(optionPrefixes = "/")
+public class SlashSeparator {
+
+ @Parameter(names = "/verbose")
+ public boolean verbose = false;
+
+ @Parameter(names = "/file")
+ public String file;
+}
diff --git a/src/test/java/com/beust/jcommander/args/VariableArity.java b/src/test/java/com/beust/jcommander/args/VariableArity.java
new file mode 100644
index 0000000..21a861d
--- /dev/null
+++ b/src/test/java/com/beust/jcommander/args/VariableArity.java
@@ -0,0 +1,26 @@
+package com.beust.jcommander.args;
+
+import com.beust.jcommander.IVariableArity;
+import com.beust.jcommander.Parameter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class VariableArity implements IVariableArity {
+
+ private int m_count;
+
+ public VariableArity(int count) {
+ m_count = count;
+ }
+
+ @Parameter
+ public List<String> main = new ArrayList<String>();
+
+ @Parameter(names = "-variable", variableArity = true)
+ public List<String> var = new ArrayList<String>();
+
+ public int processVariableArity(String optionName, String[] options) {
+ return m_count;
+ }
+}