### Question:
KeyUpdateCommand implements Callable<CliResult> { ArgonOptions argonOptions() { if ("i".equals(algorithm) || "d".equals(algorithm) || "id".equals(algorithm)) { return new ArgonOptions( algorithm, Integer.valueOf(iterations), Integer.valueOf(memory), Integer.valueOf(parallelism)); } throw new CliException(invalidArgonAlgorithmMsg); } KeyUpdateCommand(KeyEncryptorFactory keyEncryptorFactory, PasswordReader passwordReader); @Override CliResult call(); CliResult execute(); @CommandLine.Option(names = "--keys.keyData.privateKeyPath", required = true)
    public Path privateKeyPath; @CommandLine.Option(names = "--keys.keyData.config.data.aopts.algorithm", defaultValue = "i")
    public String algorithm; @CommandLine.Option(names = "--keys.keyData.config.data.aopts.iterations", defaultValue = "10")
    public Integer iterations; @CommandLine.Option(names = "--keys.keyData.config.data.aopts.memory", defaultValue = "1048576")
    public Integer memory; @CommandLine.Option(names = "--keys.keyData.config.data.aopts.parallelism", defaultValue = "4")
    public Integer parallelism; @CommandLine.Option(names = {"--keys.passwords"})
    public String password; @CommandLine.Option(names = {"--keys.passwordFile"})
    public Path passwordFile; @CommandLine.Option(
            names = {"--configfile", "-configfile"},
            description = "Path to node configuration file")
    public Config config; @CommandLine.Mixin public EncryptorOptions encryptorOptions; @CommandLine.Mixin public DebugOptions debugOptions; }### Answer:
@Test public void argonOptionsGivenHasOverrides() { command.algorithm = "d"; command.memory = 100; command.iterations = 100; command.parallelism = 100; final ArgonOptions argonOptions = command.argonOptions(); assertThat(argonOptions.getAlgorithm()).isEqualTo("d"); assertThat(argonOptions.getParallelism()).isEqualTo(100); assertThat(argonOptions.getMemory()).isEqualTo(100); assertThat(argonOptions.getIterations()).isEqualTo(100); }
@Test public void argonOptionsInvalidTypeThrowsException() { command.memory = 100; command.iterations = 100; command.parallelism = 100; command.algorithm = "i"; command.argonOptions(); command.algorithm = "d"; command.argonOptions(); command.algorithm = "id"; command.argonOptions(); command.algorithm = "invalid"; Throwable ex = catchThrowable(() -> command.argonOptions()); assertThat(ex).isInstanceOf(CliException.class); assertThat(ex).hasMessage(KeyUpdateCommand.invalidArgonAlgorithmMsg); }