/**
   * Resolves something.
   *
   * @throws Exception if failed
   */
  @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"));
  }
 @Test
 public void getProperties() {
   ExecutionContext context = new ExecutionContext();
   context.setProperty("key", "value");
   Map<String, Object> properties = context.getProperties();
   assertEquals(1, properties.size());
   assertThat(properties, hasEntry("key", (Object) "value"));
 }
  @Test(expected = IllegalStateException.class)
  public void illegalInheritance() {
    ExecutionContext context = new ExecutionContext();
    ExecutionContext parent = new ExecutionContext();

    parent.newProperty("inherited").inherited().initial("test").makeFinal().declare();
    context.newProperty("inherited").inherited().initial("test").makeFinal().declare();

    context.inheritFrom(parent);
  }
  @Test
  public void inheritance() {
    ExecutionContext context = new ExecutionContext();
    ExecutionContext parent = new ExecutionContext();

    parent.newProperty("inherited").inherited().initial("test").declare();

    parent.newProperty("shadowed").inherited().initial("original").declare();

    context.newProperty("shadowed").inherited().initial("shadowed").declare();

    context.inheritFrom(parent);

    assertTrue(context.getProperty("inherited").equals("test"));
    assertTrue(context.getProperty("shadowed").equals("shadowed"));
  }