changeset 367:ac41c65e3bb9 draft

Ten new tests added into ScriptContextTest.
author ptisnovs
date Fri, 23 May 2014 08:25:17 +0200
parents 946d61915104
children 7d807b490b62
files ChangeLog src/org/RhinoTests/ScriptContextTest.java
diffstat 2 files changed, 164 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri May 23 08:16:04 2014 +0200
+++ b/ChangeLog	Fri May 23 08:25:17 2014 +0200
@@ -1,3 +1,8 @@
+2014-05-23  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/ScriptContextTest.java:
+	Ten new tests added into ScriptContextTest.
+
 2014-05-23  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/SimpleBindingsTest.java:
--- a/src/org/RhinoTests/ScriptContextTest.java	Fri May 23 08:16:04 2014 +0200
+++ b/src/org/RhinoTests/ScriptContextTest.java	Fri May 23 08:25:17 2014 +0200
@@ -555,6 +555,165 @@
     }
 
     /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute29() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        try {
+            object.setAttribute("name", "", 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 testSetAttribute30() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        try {
+            object.setAttribute("name", 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 testSetAttribute31() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute32() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute33() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute34() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute35() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute36() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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
+        }
+    }
+
+    /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute37() {
+        // 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", "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 testSetAttribute38() {
+        // 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", "", INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+        }
+    }
+
+    /**
      * Entry point to this test case.
      *
      * @param args parameters passed from command line