4343
4444import org .junit .Test ;
4545import org .scijava .Context ;
46- import org .scijava .plugins .scripting .jruby .JRubyScriptEngine ;
4746import org .scijava .script .ScriptLanguage ;
4847import org .scijava .script .ScriptModule ;
4948import org .scijava .script .ScriptService ;
@@ -63,10 +62,8 @@ public void testBasic() throws InterruptedException, ExecutionException,
6362 final ScriptService scriptService = context .getService (ScriptService .class );
6463 final String script = "$x = 1 + 2;" ;
6564 final ScriptModule m = scriptService .run ("add.rb" , script , true ).get ();
66- final ScriptEngine engine = (ScriptEngine ) m .getReturnValue ();
67- final Object result = engine .get ("$x" );
68- // NB: Result is of type org.jruby.RubyFixnum.
69- assertEquals ("3" , result .toString ());
65+ final Object result = m .getReturnValue ();
66+ assertEquals (3L , result );
7067 }
7168
7269 @ Test
@@ -76,14 +73,15 @@ public void testLocals() throws ScriptException {
7673
7774 final ScriptLanguage language = scriptService .getLanguageByExtension ("rb" );
7875 final ScriptEngine engine = language .getScriptEngine ();
79- assertEquals (JRubyScriptEngine .class , engine .getClass ());
80- engine .put ("$hello" , 17 );
81- assertEquals ("17" , engine .eval ("$hello" ).toString ());
82- assertEquals ("17" , engine .get ("$hello" ).toString ());
76+ final String engineClassName = engine .getClass ().getName ();
77+ assertEquals ("org.jruby.embed.jsr223.JRubyEngine" , engineClassName );
78+ engine .put ("hello" , 17 );
79+ assertEquals ("17" , engine .eval ("hello" ).toString ());
80+ assertEquals ("17" , engine .get ("hello" ).toString ());
8381
8482 final Bindings bindings = engine .getBindings (ScriptContext .ENGINE_SCOPE );
8583 bindings .clear ();
86- assertEquals ("" , engine .get ("$ hello" ).toString ());
84+ assertEquals ("" , engine .get ("hello" ).toString ());
8785 }
8886
8987 // FIXME: This test currently fails due to input injection failure.
0 commit comments