# HG changeset patch # User ptisnovs # Date 1401173665 -7200 # Node ID 7d807b490b62e906a8c9174d0eaed4b675f214c9 # Parent ac41c65e3bb91f4c65c8c695bcee3cbcadf1ade6 Seven new tests added into ScriptContextTest. diff -r ac41c65e3bb9 -r 7d807b490b62 ChangeLog --- a/ChangeLog Fri May 23 08:25:17 2014 +0200 +++ b/ChangeLog Tue May 27 08:54:25 2014 +0200 @@ -1,3 +1,8 @@ +2014-05-27 Pavel Tisnovsky + + * src/org/RhinoTests/ScriptContextTest.java: + Seven new tests added into ScriptContextTest. + 2014-05-23 Pavel Tisnovsky * src/org/RhinoTests/ScriptContextTest.java: diff -r ac41c65e3bb9 -r 7d807b490b62 src/org/RhinoTests/ScriptContextTest.java --- a/src/org/RhinoTests/ScriptContextTest.java Fri May 23 08:25:17 2014 +0200 +++ b/src/org/RhinoTests/ScriptContextTest.java Tue May 27 08:54:25 2014 +0200 @@ -714,6 +714,145 @@ } /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute39() { + // tested object + ScriptContext object = new SimpleScriptContext(); + + // setup global scope + Bindings bindings = new SimpleBindings(new HashMap()); + object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); + + try { + object.setAttribute("name", null, INVALID_SCOPE); + throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope"); + } + catch (Exception e) { + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute40() { + // tested object + ScriptContext object = new SimpleScriptContext(); + + // setup global scope + Bindings bindings = new SimpleBindings(new HashMap()); + object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); + + try { + object.setAttribute("", "value", INVALID_SCOPE); + throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute41() { + // tested object + ScriptContext object = new SimpleScriptContext(); + + // setup global scope + Bindings bindings = new SimpleBindings(new HashMap()); + object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); + + try { + object.setAttribute("", "", INVALID_SCOPE); + throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute42() { + // tested object + ScriptContext object = new SimpleScriptContext(); + + // setup global scope + Bindings bindings = new SimpleBindings(new HashMap()); + object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); + + try { + object.setAttribute("", null, INVALID_SCOPE); + throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute43() { + // tested object + ScriptContext object = new SimpleScriptContext(); + + // setup global scope + Bindings bindings = new SimpleBindings(new HashMap()); + object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); + + try { + object.setAttribute(null, "value", INVALID_SCOPE); + throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute44() { + // tested object + ScriptContext object = new SimpleScriptContext(); + + // setup global scope + Bindings bindings = new SimpleBindings(new HashMap()); + object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); + + try { + object.setAttribute(null, "", INVALID_SCOPE); + throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute45() { + // tested object + ScriptContext object = new SimpleScriptContext(); + + // setup global scope + Bindings bindings = new SimpleBindings(new HashMap()); + object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE); + + try { + object.setAttribute(null, null, INVALID_SCOPE); + throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope"); + } + catch (Exception e) { + // expected exception + } + } + + /** * Entry point to this test case. * * @param args parameters passed from command line