Mercurial > hg > rhino-tests
changeset 362:bd78ec86c792 draft
Ten new tests added into SimpleScriptContextTest.
author | ptisnovs |
---|---|
date | Fri, 16 May 2014 09:39:20 +0200 |
parents | 8fa0f2667f65 |
children | 6f5566e8e8cf |
files | ChangeLog src/org/RhinoTests/SimpleScriptContextTest.java |
diffstat | 2 files changed, 155 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri May 16 09:33:09 2014 +0200 +++ b/ChangeLog Fri May 16 09:39:20 2014 +0200 @@ -1,3 +1,8 @@ +2014-05-16 Pavel Tisnovsky <ptisnovs@redhat.com> + + * src/org/RhinoTests/SimpleScriptContextTest.java: + Ten new tests added into SimpleScriptContextTest. + 2014-05-16 Pavel Tisnovsky <ptisnovs@redhat.com> * src/org/RhinoTests/SimpleScriptContextTest.java:
--- a/src/org/RhinoTests/SimpleScriptContextTest.java Fri May 16 09:33:09 2014 +0200 +++ b/src/org/RhinoTests/SimpleScriptContextTest.java Fri May 16 09:39:20 2014 +0200 @@ -78,6 +78,156 @@ } /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute1() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute("name", "value", ScriptContext.ENGINE_SCOPE); + } + catch (Exception e) { + e.printStackTrace(); + throw new AssertionError(e.getMessage()); + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute2() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute("name", "", ScriptContext.ENGINE_SCOPE); + } + catch (Exception e) { + e.printStackTrace(); + throw new AssertionError(e.getMessage()); + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute3() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute("name", null, ScriptContext.ENGINE_SCOPE); + } + catch (Exception e) { + e.printStackTrace(); + throw new AssertionError(e.getMessage()); + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute4() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute("", "value", ScriptContext.ENGINE_SCOPE); + throw new AssertionError("ScriptContext.setAttribute(\"\", \"value\", ScriptContext.ENGINE_SCOPE.) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute5() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute("", "", ScriptContext.ENGINE_SCOPE); + throw new AssertionError("ScriptContext.setAttribute(\"\", \"\", ScriptContext.ENGINE_SCOPE) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute6() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute("", null, ScriptContext.ENGINE_SCOPE); + throw new AssertionError("ScriptContext.setAttribute(\"\", null, ScriptContext.ENGINE_SCOPE) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute7() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute(null, "value", ScriptContext.ENGINE_SCOPE); + throw new AssertionError("ScriptContext.setAttribute(null, \"value\", ScriptContext.ENGINE_SCOPE) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute8() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute(null, "", ScriptContext.ENGINE_SCOPE); + throw new AssertionError("ScriptContext.setAttribute(null, \"\", ScriptContext.ENGINE_SCOPE) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute9() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute(null, null, ScriptContext.ENGINE_SCOPE); + throw new AssertionError("ScriptContext.setAttribute(null, null, ScriptContext.ENGINE_SCOPE) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + } + + /** + * Test for method SimpleScriptContext.setAttribute(). + */ + protected void testSetAttribute10() { + // tested object + SimpleScriptContext object = new SimpleScriptContext(); + try { + object.setAttribute("name", "value", ScriptContext.GLOBAL_SCOPE); + } + catch (Exception e) { + e.printStackTrace(); + throw new AssertionError(e.getMessage()); + } + } + + /** * Entry point to this test case. * * @param args parameters passed from command line