summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCedric Beust <cedric@beust.com>2012-11-10 11:41:04 -0800
committerCedric Beust <cedric@beust.com>2012-11-10 11:41:04 -0800
commitcf62891268452675c56a4b18d5866123398e1cb3 (patch)
treeab821fc6f32b606c563f4797fb5a07130e3dffd6 /src
parent07e332d70768d2f49d835ccf65628d73d2d6703f (diff)
downloadplatform_external_jcommander-cf62891268452675c56a4b18d5866123398e1cb3.tar.gz
platform_external_jcommander-cf62891268452675c56a4b18d5866123398e1cb3.tar.bz2
platform_external_jcommander-cf62891268452675c56a4b18d5866123398e1cb3.zip
New test.
Diffstat (limited to 'src')
-rw-r--r--src/test/java/com/beust/jcommander/JCommanderTest.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/test/java/com/beust/jcommander/JCommanderTest.java b/src/test/java/com/beust/jcommander/JCommanderTest.java
index 4f67f9a..356d442 100644
--- a/src/test/java/com/beust/jcommander/JCommanderTest.java
+++ b/src/test/java/com/beust/jcommander/JCommanderTest.java
@@ -977,9 +977,31 @@ public class JCommanderTest {
Assert.assertEquals(a.endpoint, Lists.newArrayList("dev"));
}
+ public void a() {
+ class Arguments {
+ @Parameter(names = { "-help", "-h" }, arity = 0, description = "Show this help message")
+ public Boolean help = false;
+
+ @Parameter(names = { "-verbose", "-v" }, arity = 0, description = "Verbose output mode")
+ public Boolean verbose = false;
+
+ @Parameter(names = { "-target" }, arity = 1, description = "Target directory", required = true)
+ public File target;
+
+ @Parameter(names = { "-input" }, variableArity = true, description = "Input paths", required = true)
+ public List<String> paths;
+ }
+ Arguments a = new Arguments();
+ new JCommander(a, new String[] {
+ "-input", "example_in1", "example_in2", "-target", "example_out" }
+ );
+ Assert.assertEquals(a.paths, Lists.newArrayList("example_in1", "example_in2"));
+ Assert.assertEquals(a.target, new File("example_out"));
+ }
+
@Test(enabled = false)
public static void main(String[] args) throws Exception {
- new JCommanderTest().listParameters(); // listArgShouldBeCleared();
+ new JCommanderTest().a();
// class A {
// @Parameter(names = "-short", required = true)
// List<String> parameters;