Map<String, String> conf = createConf();
declare(conf, "default", MockCommandScriptHandler.class);
declare(conf, "match", MockCommandScriptHandler.class);
CommandScriptHandlerDispatcher dispatcher = create(conf);
ExecutionContext context = context("flow", ExecutionPhase.MAIN);
CommandScript script = script("stage");
assertThat(dispatcher.getResourceId(context, script), is("match"));
ExecutionContext otherFlow = context("otherflow", ExecutionPhase.MAIN);
assertThat(dispatcher.getResourceId(otherFlow, script), is("default"));
ExecutionContext otherPhase = context("flow", ExecutionPhase.PROLOGUE);
assertThat(dispatcher.getResourceId(otherPhase, script), is("default"));
CommandScript otherScript = script("otherstage");
assertThat(dispatcher.getResourceId(context, otherScript), is("default"));
}