Now that Nashorn has been deprecated & removed in JDK 15 what is the best approach to validate that a String is valid Javascript in a JUnit test?
Previous Code:
private void validateJavascript(final String js) throws ScriptException {
final NashornScriptEngine scriptEngine = (NashornScriptEngine) new NashornScriptEngineFactory().getScriptEngine();
final CompiledScript compile = scriptEngine.compile(js);
}