Skip to content

Commit 7d91e4d

Browse files
committed
JavaScriptTest: relax ScriptEngine class matching
If it's Rhino, the script engine class will be called RhinoScriptEngine. But if it's Nashorn, it will be NashornScriptEngine. Of course, other potential flavors are possible too, but let's not worry about those at this moment.
1 parent df9ba05 commit 7d91e4d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/test/java/org/scijava/plugins/scripting/javascript/JavaScriptTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public void testLocals() throws ScriptException {
7777

7878
final ScriptLanguage language = scriptService.getLanguageByExtension("js");
7979
final ScriptEngine engine = language.getScriptEngine();
80-
assertTrue(engine.getClass().getName().endsWith(".RhinoScriptEngine"));
80+
final String engineClassName = engine.getClass().getName();
81+
assertTrue(engineClassName.endsWith(".RhinoScriptEngine") ||
82+
engineClassName.endsWith(".NashornScriptEngine"));
8183
engine.put("$hello", 17);
8284
assertEquals("17", engine.eval("$hello").toString());
8385
assertEquals("17", engine.get("$hello").toString());

0 commit comments

Comments
 (0)