ScriptCommand implements SoarCommand { @Override public String execute(SoarCommandContext commandContext, String[] args) throws SoarException { return Utils.parseAndRun(new Script(context, engines, manager), args); } ScriptCommand(Adaptable context); @Override String execute(SoarCommandContext commandContext, String[] args); @Override Object getCommand();  }
@Test(expected=SoarException.class) public void testThrowsAnExceptionForUnknownScriptEngines() throws Exception { command.execute(DefaultSoarCommandContext.empty(), new String[] { "script", "unknown-script-engine" }); }
@Test public void testCanEvalScriptCode() throws Exception { final String result = command.execute(DefaultSoarCommandContext.empty(), new String[] { "script", "javascript", "'hi there'" }); assertEquals("hi there", result); }
@Test public void testInstallsRhsFunctionHandler() throws Exception { command.execute(DefaultSoarCommandContext.empty(), new String[] { "script", "javascript" }); final RhsFunctionManager rhsFuncs = Adaptables.adapt(context, RhsFunctionManager.class); assertNotNull(rhsFuncs); final RhsFunctionHandler handler = rhsFuncs.getHandler("javascript"); assertNotNull(handler); }