JavaScriptInvoker { public ScriptEnginer createScriptEnginer(){ return new ScriptEnginer(); } JavaScriptInvoker(); ScriptEnginer createScriptEnginer(); JavaScriptInvoker whenError(Consumer<Throwable> errorHandler); T eval(String script, Object... args);  }
@Test public void testReturn(){ Assertions.assertThatExceptionOfType(RuntimeException.class) .isThrownBy(()->{ ScriptEnginer enginer = this.javaScriptInvoker.createScriptEnginer() .evalClassPathFile("org/onetwo/common/spring/utils/test_return.js"); enginer.invokeFunc("funcAfterReturn", new JsContext()); }) .withMessage("eval javascript error:%s", "org/onetwo/common/spring/utils/test_return.js") ; }