### Question:
JavascriptRuntime implements IJavascriptRuntime { @Override public JSObject execute(String command) { Object returnValue = engine.executeScript(command); if (returnValue instanceof JSObject) { return (JSObject) returnValue; } return null; }  static IJavascriptRuntime getInstance(); static void setDefaultWebEngine(IWebEngine e); @Override JSObject execute(String command); @Override String getConstructor(String javascriptObjectType, Object... args); @Override String getArrayConstructor(String javascriptObjectType, Object[] ary); @Override String getFunction(String variable, String function, Object... args); @Override String getFunction(String function, Object... args); @Override String getArrayFunction(String function, Object[] ary); static void setJavascriptRuntime(IJavascriptRuntime testRuntime); static IWebEngine engine; }### Answer:
@Test public void testExecute() { String command = "myCommand"; when(mockWebEngine.executeScript(command)).thenReturn(mockJsObject); assertEquals( JavascriptRuntime.getInstance().execute(command), mockJsObject); }