### Question:
CommandScript implements ExecutionScript { @Override public CommandScript resolve( ExecutionContext context, ExecutionScriptHandler<?> handler) throws InterruptedException, IOException { if (context == null) { throw new IllegalArgumentException("context must not be null"); } if (handler == null) { throw new IllegalArgumentException("handler must not be null"); } if (isResolved()) { return this; } LOG.debug("Resolving {}", this); PlaceholderResolver resolver = new PlaceholderResolver(this, context, handler); List<String> resolvedCommands = new ArrayList<>(); for (String token : getCommandLineTokens()) { resolvedCommands.add(resolver.resolve(token)); } LOG.debug("Resolved command line tokens: {}", resolvedCommands); Map<String, String> resolvedEnvironments = new LinkedHashMap<>(); for (Map.Entry<String, String> entry : getEnvironmentVariables().entrySet()) { resolvedEnvironments.put(entry.getKey(), resolver.resolve(entry.getValue())); } LOG.debug("Resolved environment variables: {}", resolvedEnvironments); return new CommandScript( getId(), getBlockerIds(), getProfileName(), getModuleName(), resolvedCommands, resolvedEnvironments, supportedExtensions, true); } CommandScript(
            String id, Set<String> blockerIds,
            String profileName, String moduleName,
            List<String> command,
            Map<String, String> environmentVariables);  CommandScript(
            String id, Set<String> blockerIds,
            String profileName, String moduleName,
            List<String> command, Map<String, String> environmentVariables,
            Collection<String> supportedExtensions); private  CommandScript(
            String id,
            Set<String> blockerIds,
            String profileName,
            String moduleName,
            List<String> command,
            Map<String, String> environmentVariables,
            Collection<String> supportedExtensions,
            boolean resolved); @Override Kind getKind(); @Override String getId(); @Override Set<String> getBlockerIds(); String getProfileName(); String getModuleName(); List<String> getCommandLineTokens(); @Override Map<String, String> getEnvironmentVariables(); @Override Set<String> getSupportedExtensions(); @Override boolean isResolved(); @Override CommandScript resolve(
            ExecutionContext context,
            ExecutionScriptHandler<?> handler); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final String DEFAULT_PROFILE_NAME; }### Answer:
@Test public void resolve() throws Exception { CommandScript script = new CommandScript( "testing", set("blk1", "blk2"), "profile", "module", Arrays.asList( ExecutionScript.PLACEHOLDER_HOME + "/cmd1", ExecutionScript.PLACEHOLDER_EXECUTION_ID, ExecutionScript.PLACEHOLDER_ARGUMENTS), map("ASAKUSA_HOME", ExecutionScript.PLACEHOLDER_HOME)); ExecutionContext context = new ExecutionContext("b", "f", "e", ExecutionPhase.MAIN, map("arg", "ARG")); CommandScript resolved = script.resolve( context, handler(ExecutionScriptHandler.KEY_ENV_PREFIX + "ASAKUSA_HOME", "ah")); assertThat(resolved.isResolved(), is(true)); assertThat(resolved.getCommandLineTokens(), is(Arrays.asList("ah/cmd1", "e", context.getArgumentsAsString()))); assertThat(resolved.getEnvironmentVariables().size(), is(1)); assertThat(resolved.getEnvironmentVariables().get("ASAKUSA_HOME"), is("ah")); }