JCommanderParameterResolver implements ParameterResolver { @Override public ValueResult resolve(MethodParameter methodParameter, List<String> words) { JCommander jCommander = createJCommander(methodParameter); jCommander.parse(words.toArray(new String[words.size()])); return new ValueResult(methodParameter, jCommander.getObjects().get(0)); }  @Autowired(required = false) void setValidatorFactory(ValidatorFactory validatorFactory); @Override boolean supports(MethodParameter parameter); @Override ValueResult resolve(MethodParameter methodParameter, List<String> words); @Override Stream<ParameterDescription> describe(MethodParameter parameter); @Override List<CompletionProposal> complete(MethodParameter parameter, CompletionContext context);  }
@Test public void testPojoValuesAreCorrectlySet() { MethodParameter methodParameter = Utils.createMethodParameter(COMMAND_METHOD, 0); FieldCollins resolved = (FieldCollins) resolver .resolve(methodParameter, asList("--name foo -level 2 something-else yet-something-else".split(" "))) .resolvedValue(); assertThat(resolved.getName()).isEqualTo("foo"); assertThat(resolved.getLevel()).isEqualTo(2); assertThat(resolved.getRest()).containsOnlyOnce("something-else", "yet-something-else"); }