Code example for SimpleBindings

Methods: put

0
public class JscriptExecutorTest { 
 
    @Test
    public void testExecScript() throws Exception {
 
        Bindings bindings = new SimpleBindings();
        final JScriptConsole jScriptConsole = new JScriptConsole();
        bindings.put("console", jScriptConsole);
 
        JscriptExecutor.execScript("var a = 42 + 'ggg'; console.log(a);", bindings);
        Assert.assertEquals("42ggg", jScriptConsole.out());
    } 
 
} 
Experience pair programming with AI  Get Codota for Java