### Question:
FilledEnvironmentVariablesCmdExecutor implements CmdExecutor { @Override public String executeCommand(final String command, final Map<String, String> environmentVariables, final File workDir, final String username) { return cmdExecutor.executeCommand(withFilledEnvironmentVariables(command, environmentVariables), environmentVariables, workDir, username); } FilledEnvironmentVariablesCmdExecutor(final CmdExecutor cmdExecutor); @Override String executeCommand(final String command,
                                 final Map<String, String> environmentVariables,
                                 final File workDir,
                                 final String username); @Override Process launchCommand(final String command,
                                 final Map<String, String> environmentVariables,
                                 final File workDir,
                                 final String username);  }### Answer:
@Test public void executeCommandShouldReplaceAllOccurredEnvironmentVariablesInCommand() { final Map<String, String> envVars = new HashMap<>(); envVars.put("HOME", "/path/to/home/directory"); envVars.put("API_TOKEN", "token"); cmdExecutor.executeCommand("ls {{HOME}} && echo {{API_TOKEN}}", envVars); verify(innerExecutor).executeCommand(eq("ls /path/to/home/directory && echo token"), eq(envVars), isNull(), isNull()); }