public void shouldQuoteOriginalCommand() {
connectionOptions.set(SUDO_COMMAND_PREFIX, "su -u {0}");
connectionOptions.set(SUDO_QUOTE_COMMAND, true);
connection = new SshSudoConnection(SSH_PROTOCOL, connectionOptions, resolver);
CmdLine cmdLine = connection.processCommandLine(CmdLine.build("ls", "/tmp"));
List<CmdLineArgument> args = cmdLine.getArguments();
assertThat(args.size(), equalTo(4));
assertThat(args.get(0).toString(UNIX, false), equalTo("su"));
assertThat(args.get(1).toString(UNIX, false), equalTo("-u"));
assertThat(args.get(2).toString(UNIX, false), equalTo("some-other-user"));
assertThat(args.get(3).toString(UNIX, false), equalTo("ls\\ /tmp"));
assertThat(cmdLine.toString(), equalTo("su -u some-other-user ls\\ /tmp"));
}