### Question:
FileBasedSubCommand extends SignerSubCommand { @Override public String toString() { return MoreObjects.toStringHelper(this) .add("passwordFilePath", passwordFilePath) .add("keyFilePath", keyFilePath) .toString(); } FileBasedSubCommand(); @Override SignerProvider createSignerFactory(); @Override String getCommandName(); @Override String toString(); static final String COMMAND_NAME; }### Answer:
@Test public void fullyPopulatedCommandLineParsesIntoVariables() { final List<String> options = toOptionsList(baseCommandOptions()); options.add(COMMAND_NAME); options.addAll(toOptionsList(subCommandCliOptions())); final boolean result = parser.parseCommandLine(options.toArray(String[]::new)); assertThat(result).isTrue(); assertThat(subCommand.toString()).contains(PASSWORD_FILE); assertThat(subCommand.toString()).contains(KEY_FILE); }
@Test public void fullyPopulatedConfigFileParsesIntoVariables() { final Map<String, Object> options = baseCommandOptions(); options.putAll(subCommandConfigFileOptions()); final List<String> cmdOptions = CmdlineHelpers.toConfigFileOptionsList(tempDir, options); cmdOptions.add(COMMAND_NAME); final boolean result = parser.parseCommandLine(cmdOptions.toArray(String[]::new)); assertThat(result).isTrue(); assertThat(subCommand.toString()).contains(PASSWORD_FILE); assertThat(subCommand.toString()).contains(KEY_FILE); }
@Test public void environmentVariablesParsesAndValidates() { environmentVariablesMap.putAll(toEnvironmentMap("ethsigner", baseCommandOptions())); environmentVariablesMap.putAll( toEnvironmentMap("ethsigner", COMMAND_NAME, subCommandCliOptions())); final boolean result = parser.parseCommandLine(COMMAND_NAME); assertThat(result).isTrue(); assertThat(subCommand.toString()).contains(PASSWORD_FILE); assertThat(subCommand.toString()).contains(KEY_FILE); }