Mercurial > hg > rhino-tests
changeset 368:7d807b490b62 draft default tip
Seven new tests added into ScriptContextTest.
author | ptisnovs |
---|---|
date | Tue, 27 May 2014 08:54:25 +0200 |
parents | ac41c65e3bb9 |
children | |
files | ChangeLog src/org/RhinoTests/ScriptContextTest.java |
diffstat | 2 files changed, 144 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ptisnovs@redhat.com> + + * src/org/RhinoTests/ScriptContextTest.java: + Seven new tests added into ScriptContextTest. + 2014-05-23 Pavel Tisnovsky <ptisnovs@redhat.com> * 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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