/hg/rhino-tests: Added new tests into src/org/RhinoTests/Binding...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Mon Nov 26 02:31:08 PST 2012
changeset 4876f3e3df53 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=4876f3e3df53
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Nov 26 11:34:08 2012 +0100
Added new tests into src/org/RhinoTests/BindingsTest.java for checking constructor behaviour.
Fixed existing tests to avoid compiler (ecj) warnings.
diffstat:
ChangeLog | 6 ++++
src/org/RhinoTests/BindingsTest.java | 47 ++++++++++++++++++++++++++++++++++-
2 files changed, 51 insertions(+), 2 deletions(-)
diffs (88 lines):
diff -r 24686f9e632a -r 4876f3e3df53 ChangeLog
--- a/ChangeLog Thu Nov 22 10:38:39 2012 +0100
+++ b/ChangeLog Mon Nov 26 11:34:08 2012 +0100
@@ -1,3 +1,9 @@
+2012-11-26 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/BindingsTest.java:
+ Added new tests for checking constructor behaviour.
+ Fixed existing tests to avoid compiler (ecj) warnings.
+
2012-11-22 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/JavaScriptSnippets.java:
diff -r 24686f9e632a -r 4876f3e3df53 src/org/RhinoTests/BindingsTest.java
--- a/src/org/RhinoTests/BindingsTest.java Thu Nov 22 10:38:39 2012 +0100
+++ b/src/org/RhinoTests/BindingsTest.java Mon Nov 26 11:34:08 2012 +0100
@@ -41,6 +41,7 @@
package org.RhinoTests;
import java.util.HashMap;
+import java.util.Map;
import java.util.TreeMap;
import javax.script.SimpleBindings;
@@ -72,19 +73,61 @@
}
protected void testConstructor2() {
- Bindings bindings = new SimpleBindings(new HashMap());
+ Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
assertNotNull(bindings, "new SimpleBindings() failed");
assertTrue(bindings.isEmpty(), "bindings should be empty");
assertTrue(bindings.size() == 0, "bindings should be empty");
}
protected void testConstructor3() {
- Bindings bindings = new SimpleBindings(new TreeMap());
+ Bindings bindings = new SimpleBindings(new TreeMap<String, Object>());
assertNotNull(bindings, "new SimpleBindings() failed");
assertTrue(bindings.isEmpty(), "bindings should be empty");
assertTrue(bindings.size() == 0, "bindings should be empty");
}
+ protected void testConstructor4() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("key", "value");
+ 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");
+ assertNotNull(bindings.get("key"), "this object should be stored in bindings");
+ assertEquals(bindings.get("key"), "value", "wrong value returned");
+ }
+
+ protected void testConstructor5() {
+ Map<String, Object> map = new TreeMap<String, Object>();
+ map.put("key", "value");
+ 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");
+ assertNotNull(bindings.get("key"), "this object should be stored in bindings");
+ assertEquals(bindings.get("key"), "value", "wrong value returned");
+ }
+
+ protected void testConstructor6() {
+ Map<String, Object> map = new HashMap<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 testConstructor7() {
+ Map<String, Object> map = new HashMap<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 testContainsKey1() {
Bindings bindings = new SimpleBindings();
assertFalse(bindings.containsKey("key"), "Bingings.containsKey() failed");
More information about the distro-pkg-dev
mailing list