Page implements Serializable { @Deprecated public ExecutionCanceler executeJavaScript(String expression, Serializable... parameters) { return executeJs(expression, parameters); } Page(UI ui); void setTitle(String title); void addStyleSheet(String url); void addStyleSheet(String url, LoadMode loadMode); void addJavaScript(String url); void addJavaScript(String url, LoadMode loadMode); void addJsModule(String url); void addDynamicImport(String expression); @Deprecated ExecutionCanceler executeJavaScript(String expression,
            Serializable... parameters); PendingJavaScriptResult executeJs(String expression,
            Serializable... parameters); History getHistory(); void reload(); Registration addBrowserWindowResizeListener(
            BrowserWindowResizeListener resizeListener); void open(String url); void open(String url, String windowName); void setLocation(String uri); void setLocation(URI uri); void retrieveExtendedClientDetails(
            ExtendedClientDetailsReceiver receiver);  }
@Test public void executeJavaScript_delegatesToExecJs() { AtomicReference<String> invokedExpression = new AtomicReference<>(); AtomicReference<Serializable[]> invokedParams = new AtomicReference<>(); Page page = new Page(new MockUI()) { @Override public PendingJavaScriptResult executeJs(String expression, Serializable... parameters) { String oldExpression = invokedExpression.getAndSet(expression); Assert.assertNull("There should be no old expression", oldExpression); Serializable[] oldParams = invokedParams.getAndSet(parameters); Assert.assertNull("There should be no old params", oldParams); return null; } }; ExecutionCanceler executionCanceler = page.executeJavaScript("foo", 1, true); Assert.assertNull(executionCanceler); Assert.assertEquals("foo", invokedExpression.get()); Assert.assertEquals(Integer.valueOf(1), invokedParams.get()[0]); Assert.assertEquals(Boolean.TRUE, invokedParams.get()[1]); }