--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Mon Jan 05 16:02:56 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Wed Jan 07 14:02:30 2015 +0530
@@ -27,6 +27,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.io.StringReader;
@@ -668,6 +669,17 @@
assertEquals("helloworld", inv.invokeMethod(ctx.get(), "join", ""));
}
+ // @bug 8068524: NashornScriptEngineFactory.getParameter() throws IAE
+ // for an unknown key, doesn't conform to the general spec
+ @Test
+ public void getParameterInvalidKeyTest() throws Exception {
+ final ScriptEngineManager manager = new ScriptEngineManager();
+ final ScriptEngine e = manager.getEngineByName("nashorn");
+ // no exception expected here!
+ Object value = e.getFactory().getParameter("no value assigned to this key");
+ assertNull(value);
+ }
+
private static void checkProperty(final ScriptEngine e, final String name)
throws ScriptException {
final String value = System.getProperty(name);