@Test
public void testJavaScript() throws Exception {

   ScriptEngineManager mgr = new ScriptEngineManager();
   ScriptEngine engine = mgr.getEngineByExtension("js");
   String script = "function helloFunction(name) { var result='Hello, ' + name; return result;}";
   engine.eval(script);
   Invocable inv = (Invocable) engine;
   String actual = (String) inv.invokeFunction("helloFunction", "Scripting");
   String expected = "Hello, Scripting";
   Assert.assertEquals(expected, actual);
}