/hg/rhino-tests: Nine new tests added into BindingsTest.
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Tue Apr 15 11:18:59 UTC 2014
changeset 6cb1ff232c39 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=6cb1ff232c39
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Apr 15 13:19:41 2014 +0200
Nine new tests added into BindingsTest.
diffstat:
ChangeLog | 5 +
src/org/RhinoTests/BindingsTest.java | 98 ++++++++++++++++++++++++++++++++++-
2 files changed, 98 insertions(+), 5 deletions(-)
diffs (178 lines):
diff -r 9b40969f01e3 -r 6cb1ff232c39 ChangeLog
--- a/ChangeLog Thu Apr 10 11:05:49 2014 +0200
+++ b/ChangeLog Tue Apr 15 13:19:41 2014 +0200
@@ -1,3 +1,8 @@
+2014-04-15 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/BindingsTest.java:
+ Nine new tests added into BindingsTest.
+
2014-04-10 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/CompiledScriptTest.java:
diff -r 9b40969f01e3 -r 6cb1ff232c39 src/org/RhinoTests/BindingsTest.java
--- a/src/org/RhinoTests/BindingsTest.java Thu Apr 10 11:05:49 2014 +0200
+++ b/src/org/RhinoTests/BindingsTest.java Tue Apr 15 13:19:41 2014 +0200
@@ -1,7 +1,7 @@
/*
Rhino test framework
- Copyright (C) 2011, 2012 Red Hat
+ Copyright (C) 2011, 2012, 2013, 2014 Red Hat
This file is part of IcedTea.
@@ -41,15 +41,18 @@
package org.RhinoTests;
import java.util.HashMap;
+import java.util.Hashtable;
import java.util.Map;
+import java.util.LinkedHashMap;
import java.util.TreeMap;
import javax.script.SimpleBindings;
import javax.script.Bindings;
/**
+ * Test for the class javax.script.Bingings.
+ *
* @author Pavel Tisnovsky
- *
*/
public class BindingsTest extends BaseRhinoTest {
@@ -65,6 +68,9 @@
return;
}
+ /**
+ * Test of the default constructor.
+ */
protected void testConstructor1() {
Bindings bindings = new SimpleBindings();
assertNotNull(bindings, "new SimpleBindings() failed");
@@ -72,6 +78,9 @@
assertTrue(bindings.size() == 0, "bindings should be empty");
}
+ /**
+ * Test of the constructor with Map parameter..
+ */
protected void testConstructor2() {
Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
assertNotNull(bindings, "new SimpleBindings() failed");
@@ -87,6 +96,20 @@
}
protected void testConstructor4() {
+ Bindings bindings = new SimpleBindings(new Hashtable<String, Object>());
+ assertNotNull(bindings, "new SimpleBindings() failed");
+ assertTrue(bindings.isEmpty(), "bindings should be empty");
+ assertTrue(bindings.size() == 0, "bindings should be empty");
+ }
+
+ protected void testConstructor5() {
+ Bindings bindings = new SimpleBindings(new LinkedHashMap<String, Object>());
+ assertNotNull(bindings, "new SimpleBindings() failed");
+ assertTrue(bindings.isEmpty(), "bindings should be empty");
+ assertTrue(bindings.size() == 0, "bindings should be empty");
+ }
+
+ protected void testConstructor6() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("key", "value");
Bindings bindings = new SimpleBindings(map);
@@ -97,7 +120,7 @@
assertEquals(bindings.get("key"), "value", "wrong value returned");
}
- protected void testConstructor5() {
+ protected void testConstructor7() {
Map<String, Object> map = new TreeMap<String, Object>();
map.put("key", "value");
Bindings bindings = new SimpleBindings(map);
@@ -108,7 +131,29 @@
assertEquals(bindings.get("key"), "value", "wrong value returned");
}
- protected void testConstructor6() {
+ protected void testConstructor8() {
+ Map<String, Object> hashtable = new Hashtable<String, Object>();
+ hashtable.put("key", "value");
+ Bindings bindings = new SimpleBindings(hashtable);
+ assertNotNull(bindings, "new SimpleBindings() failed");
+ assertTrue(!bindings.isEmpty(), "bindings should not be empty");
+ assertTrue(bindings.size() == 1, "bindings should not be empty");
+ assertNotNull(bindings.get("key"), "this object should be stored in bindings");
+ assertEquals(bindings.get("key"), "value", "wrong value returned");
+ }
+
+ protected void testConstructor9() {
+ Map<String, Object> hashtable = new LinkedHashMap<String, Object>();
+ hashtable.put("key", "value");
+ Bindings bindings = new SimpleBindings(hashtable);
+ assertNotNull(bindings, "new SimpleBindings() failed");
+ assertTrue(!bindings.isEmpty(), "bindings should not be empty");
+ assertTrue(bindings.size() == 1, "bindings should not be empty");
+ assertNotNull(bindings.get("key"), "this object should be stored in bindings");
+ assertEquals(bindings.get("key"), "value", "wrong value returned");
+ }
+
+ protected void testConstructor10() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("key", null);
Bindings bindings = new SimpleBindings(map);
@@ -118,8 +163,51 @@
assertNull(bindings.get("key"), "this object should be stored in bindings");
}
- protected void testConstructor7() {
+ protected void testConstructor11() {
+ Map<String, Object> map = new TreeMap<String, Object>();
+ map.put("key", null);
+ Bindings bindings = new SimpleBindings(map);
+ assertNotNull(bindings, "new SimpleBindings() failed");
+ assertTrue(!bindings.isEmpty(), "bindings should not be empty");
+ assertTrue(bindings.size() == 1, "bindings should not be empty");
+ assertNull(bindings.get("key"), "this object should be stored in bindings");
+ }
+
+ protected void testConstructor12() {
+ Map<String, Object> map = new LinkedHashMap<String, Object>();
+ map.put("key", "value");
+ map.put("key", null);
+ Bindings bindings = new SimpleBindings(map);
+ assertNotNull(bindings, "new SimpleBindings() failed");
+ assertTrue(!bindings.isEmpty(), "bindings should not be empty");
+ assertTrue(bindings.size() == 1, "bindings should not be empty");
+ assertNull(bindings.get("key"), "this object should be stored in bindings");
+ }
+
+ protected void testConstructor13() {
Map<String, Object> map = new HashMap<String, Object>();
+ map.put("key", "value");
+ map.put("key", null);
+ Bindings bindings = new SimpleBindings(map);
+ assertNotNull(bindings, "new SimpleBindings() failed");
+ assertTrue(!bindings.isEmpty(), "bindings should not be empty");
+ assertTrue(bindings.size() == 1, "bindings should not be empty");
+ assertNull(bindings.get("key"), "this object should be stored in bindings");
+ }
+
+ protected void testConstructor14() {
+ Map<String, Object> map = new TreeMap<String, Object>();
+ map.put("key", "value");
+ map.put("key", null);
+ Bindings bindings = new SimpleBindings(map);
+ assertNotNull(bindings, "new SimpleBindings() failed");
+ assertTrue(!bindings.isEmpty(), "bindings should not be empty");
+ assertTrue(bindings.size() == 1, "bindings should not be empty");
+ assertNull(bindings.get("key"), "this object should be stored in bindings");
+ }
+
+ protected void testConstructor15() {
+ Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("key", null);
Bindings bindings = new SimpleBindings(map);
assertNotNull(bindings, "new SimpleBindings() failed");
More information about the distro-pkg-dev
mailing list