DefaultScriptHandler implements ScriptHandler { @Override public Object runScript(ScriptFragment scriptFragment) { ScriptRunner process = get(scriptFragment); if (process == null) { throw new IllegalArgumentException("can not find ScriptRunner for " + scriptFragment.toScriptString()); } return process.run(scriptFragment); } DefaultScriptHandler(); @Override Object runScript(ScriptFragment scriptFragment); @Override void register(ScriptRunnerModule scriptRunnerModule); @Override void register(ScriptRunner scriptRunner); ScriptRunner get(ScriptFragment scriptFragment);  }
@Test public void testRunScript() { scriptHandler.register(new TestScriptRunner()); assertEquals(1, scriptHandler.runScript(ScriptFragment.of("fortest"))); }
@Test(expected = IllegalArgumentException.class) public void testRaiseError() { scriptHandler.runScript(ScriptFragment.of("fail")); }