Skip to content

Commit

Permalink
Add tests for remkop#803
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickptibco authored and byteit101 committed Sep 8, 2019
1 parent 06d37d1 commit 0025569
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,20 @@ public void testGenerateReflectConfigArgGroup() {
.generatedFile(StandardLocation.CLASS_OUTPUT, "META-INF/native-image/picocli-generated/issue793/reflect-config.json")
.contentsAsUtf8String().isEqualTo(slurp("/picocli/issue793/issue793-reflect-config.json"));
}

@Test
public void testGenerateReflectConfigParamConsumer() {
NativeImageConfigGeneratorProcessor processor = new NativeImageConfigGeneratorProcessor();
Compilation compilation =
javac()
.withProcessors(processor)
.withOptions("-A" + OPTION_PROJECT + "=issue803")
.compile(JavaFileObjects.forSourceLines(
"picocli.issue803.Issue803",
slurp("/picocli/issue803/Issue803.java")));
assertThat(compilation).succeeded();
assertThat(compilation)
.generatedFile(StandardLocation.CLASS_OUTPUT, "META-INF/native-image/picocli-generated/issue803/reflect-config.json")
.contentsAsUtf8String().isEqualTo(slurp("/picocli/issue803/issue803-reflect-config.json"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package picocli.issue803;

import picocli.CommandLine.*;
import picocli.CommandLine.Model.*;

import java.util.Stack;
import java.util.concurrent.Callable;

import picocli.CommandLine;

@Command
public class Issue803 implements Callable<Integer> {
@Parameters(index = "0", description = "Ignored", parameterConsumer = LocalPC.class)
private String file;
@Override
public Integer call() throws Exception {return 0;}

public static class LocalPC implements IParameterConsumer {
@Override public void consumeParameters(Stack<String> args, ArgSpec argSpec, CommandSpec commandSpec) {return;}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"name" : "picocli.issue803.Issue803",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"fields" : [
{ "name" : "file" }
]
},
{
"name" : "picocli.issue803$LocalPC",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true
}
]

0 comments on commit 0025569

Please sign in to comment.