/hg/rhino-tests: Ten new tests added into SimpleScriptContextTest.
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Tue May 20 07:12:18 UTC 2014
changeset 67c8a396f43f in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=67c8a396f43f
author: ptisnovs
date: Tue May 20 09:12:11 2014 +0200
Ten new tests added into SimpleScriptContextTest.
diffstat:
ChangeLog | 5 +
src/org/RhinoTests/SimpleScriptContextTest.java | 132 ++++++++++++++++++++++++
2 files changed, 137 insertions(+), 0 deletions(-)
diffs (171 lines):
diff -r 7d92b73d875d -r 67c8a396f43f ChangeLog
--- a/ChangeLog Tue May 20 09:04:26 2014 +0200
+++ b/ChangeLog Tue May 20 09:12:11 2014 +0200
@@ -1,3 +1,8 @@
+2014-05-20 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/SimpleScriptContextTest.java:
+ Ten new tests added into SimpleScriptContextTest.
+
2014-05-20 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/ScriptContextTest.java:
diff -r 7d92b73d875d -r 67c8a396f43f src/org/RhinoTests/SimpleScriptContextTest.java
--- a/src/org/RhinoTests/SimpleScriptContextTest.java Tue May 20 09:04:26 2014 +0200
+++ b/src/org/RhinoTests/SimpleScriptContextTest.java Tue May 20 09:12:11 2014 +0200
@@ -40,9 +40,15 @@
package org.RhinoTests;
+import java.util.HashMap;
+
+import javax.script.Bindings;
+import javax.script.SimpleBindings;
import javax.script.ScriptContext;
import javax.script.SimpleScriptContext;
+
+
/**
* Basic ScriptContext test suite. Following tests checks the interface
* javax.script.SimpleScriptContext.
@@ -51,6 +57,12 @@
*/
public class SimpleScriptContextTest extends BaseRhinoTest {
+ /**
+ * Many methods accepts ScriptContext.GLOBAL_SCOPE or ScriptContext.ENGINE_SCOPE
+ * as one integer parameters. Let's see how those methods works with different value.
+ */
+ private final static Integer INVALID_SCOPE = 42;
+
@Override
protected void setUp(String[] args) {
// this block could be empty
@@ -228,6 +240,126 @@
}
/**
+ * Test for method SimpleScriptContext.setAttribute().
+ */
+ protected void testSetAttribute11() {
+ // tested object
+ SimpleScriptContext object = new SimpleScriptContext();
+ try {
+ object.setAttribute("name", "", ScriptContext.GLOBAL_SCOPE);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+
+ /**
+ * Test for method SimpleScriptContext.setAttribute().
+ */
+ protected void testSetAttribute12() {
+ // tested object
+ SimpleScriptContext object = new SimpleScriptContext();
+ try {
+ object.setAttribute("name", null, ScriptContext.GLOBAL_SCOPE);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+
+ /**
+ * Test for method SimpleScriptContext.setAttribute().
+ */
+ protected void testSetAttribute13() {
+ // tested object
+ SimpleScriptContext object = new SimpleScriptContext();
+ try {
+ object.setAttribute("", "value", ScriptContext.GLOBAL_SCOPE);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+
+ /**
+ * Test for method SimpleScriptContext.setAttribute().
+ */
+ protected void testSetAttribute14() {
+ // tested object
+ SimpleScriptContext object = new SimpleScriptContext();
+ try {
+ object.setAttribute("", "", ScriptContext.GLOBAL_SCOPE);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+
+ /**
+ * Test for method SimpleScriptContext.setAttribute().
+ */
+ protected void testSetAttribute15() {
+ // tested object
+ SimpleScriptContext object = new SimpleScriptContext();
+ try {
+ object.setAttribute("", null, ScriptContext.GLOBAL_SCOPE);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+
+ /**
+ * Test for method SimpleScriptContext.setAttribute().
+ */
+ protected void testSetAttribute16() {
+ // tested object
+ SimpleScriptContext object = new SimpleScriptContext();
+ try {
+ object.setAttribute(null, "value", ScriptContext.GLOBAL_SCOPE);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+
+ /**
+ * Test for method SimpleScriptContext.setAttribute().
+ */
+ protected void testSetAttribute17() {
+ // tested object
+ SimpleScriptContext object = new SimpleScriptContext();
+ try {
+ object.setAttribute(null, "", ScriptContext.GLOBAL_SCOPE);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new AssertionError(e.getMessage());
+ }
+ }
+
+ /**
+ * Test for method SimpleScriptContext.setAttribute().
+ */
+ protected void testSetAttribute18() {
+ // tested object
+ SimpleScriptContext object = new SimpleScriptContext();
+ try {
+ object.setAttribute(null, null, 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
More information about the distro-pkg-dev
mailing list