/hg/rhino-tests: Added JavaDoc and four new tests into SimpleBin...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Tue May 20 06:52:53 UTC 2014
changeset 6f5566e8e8cf in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=6f5566e8e8cf
author: ptisnovs
date: Tue May 20 08:52:43 2014 +0200
Added JavaDoc and four new tests into SimpleBindingsTest suite.
diffstat:
ChangeLog | 5 +
src/org/RhinoTests/SimpleBindingsTest.java | 92 +++++++++++++++++++++++++++++-
2 files changed, 95 insertions(+), 2 deletions(-)
diffs (182 lines):
diff -r bd78ec86c792 -r 6f5566e8e8cf ChangeLog
--- a/ChangeLog Fri May 16 09:39:20 2014 +0200
+++ b/ChangeLog Tue May 20 08:52:43 2014 +0200
@@ -1,3 +1,8 @@
+2014-05-20 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/SimpleBindingsTest.java:
+ Added JavaDoc and four new tests into SimpleBindingsTest suite.
+
2014-05-16 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/SimpleScriptContextTest.java:
diff -r bd78ec86c792 -r 6f5566e8e8cf src/org/RhinoTests/SimpleBindingsTest.java
--- a/src/org/RhinoTests/SimpleBindingsTest.java Fri May 16 09:39:20 2014 +0200
+++ b/src/org/RhinoTests/SimpleBindingsTest.java Tue May 20 08:52:43 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.
@@ -46,8 +46,10 @@
import javax.script.SimpleBindings;
/**
+ * Basic SimpleBindings test suite. Following tests checks the class
+ * javax.script.SimpleBindings.
+ *
* @author Pavel Tisnovsky
- *
*/
public class SimpleBindingsTest extends BaseRhinoTest {
@@ -63,6 +65,9 @@
return;
}
+ /**
+ * Test for constructor without parameters.
+ */
protected void testConstructor1() {
SimpleBindings simpleBindings = new SimpleBindings();
assertNotNull(simpleBindings, "new SimpleBindings() failed");
@@ -70,6 +75,9 @@
assertTrue(simpleBindings.size() == 0, "simpleBindings should be empty");
}
+ /**
+ * Test for constructor with the parameter Map<String,Object>
+ */
protected void testConstructor2() {
SimpleBindings simpleBindings = new SimpleBindings(new HashMap<String, Object>());
assertNotNull(simpleBindings, "new SimpleBindings() failed");
@@ -77,6 +85,9 @@
assertTrue(simpleBindings.size() == 0, "simpleBindings should be empty");
}
+ /**
+ * Test for constructor with the parameter Map<String,Object>
+ */
protected void testConstructor3() {
SimpleBindings simpleBindings = new SimpleBindings(new TreeMap<String, Object>());
assertNotNull(simpleBindings, "new SimpleBindings() failed");
@@ -84,17 +95,60 @@
assertTrue(simpleBindings.size() == 0, "simpleBindings should be empty");
}
+ /**
+ * Test for method containsKey(String)
+ */
protected void testContainsKey1() {
SimpleBindings simpleBindings = new SimpleBindings();
assertFalse(simpleBindings.containsKey("key"), "Bingings.containsKey() failed");
}
+ /**
+ * Test for method containsKey(String)
+ */
protected void testContainsKey2() {
SimpleBindings simpleBindings = new SimpleBindings();
simpleBindings.put("key", "value");
assertTrue(simpleBindings.containsKey("key"), "Bingings.containsKey() failed");
}
+ /**
+ * Test for method containsKey(String)
+ */
+ protected void testContainsKey3() {
+ SimpleBindings simpleBindings = new SimpleBindings(new HashMap<String, Object>());
+ assertFalse(simpleBindings.containsKey("key"), "Bingings.containsKey() failed");
+ }
+
+ /**
+ * Test for method containsKey(String)
+ */
+ protected void testContainsKey4() {
+ SimpleBindings simpleBindings = new SimpleBindings(new HashMap<String, Object>());
+ simpleBindings.put("key", "value");
+ assertTrue(simpleBindings.containsKey("key"), "Bingings.containsKey() failed");
+ }
+
+ /**
+ * Test for method containsKey(String)
+ */
+ protected void testContainsKey5() {
+ SimpleBindings simpleBindings = new SimpleBindings(new TreeMap<String, Object>());
+ assertFalse(simpleBindings.containsKey("key"), "Bingings.containsKey() failed");
+ }
+
+ /**
+ * Test for method containsKey(String)
+ */
+ protected void testContainsKey6() {
+ SimpleBindings simpleBindings = new SimpleBindings(new TreeMap<String, Object>());
+ simpleBindings.put("key", "value");
+ assertTrue(simpleBindings.containsKey("key"), "Bingings.containsKey() failed");
+ }
+
+ /**
+ * Test for method containsKey(String)
+ */
protected void testContainsKeyNegative1() throws Exception {
SimpleBindings simpleBindings = new SimpleBindings();
try {
@@ -106,6 +160,9 @@
throw new Exception("NPE did not thrown as expected");
}
+ /**
+ * Test for method containsKey(String)
+ */
protected void testContainsKeyNegative2() throws Exception {
SimpleBindings simpleBindings = new SimpleBindings();
try {
@@ -117,6 +174,9 @@
throw new Exception("IllegalArgumentException did not thrown as expected");
}
+ /**
+ * Test for method containsKey(String)
+ */
protected void testContainsKeyNegative3() throws Exception {
SimpleBindings simpleBindings = new SimpleBindings();
try {
@@ -129,6 +189,34 @@
}
/**
+ * Test for method containsKey(String)
+ */
+ protected void testContainsKeyNegative4() throws Exception {
+ SimpleBindings simpleBindings = new SimpleBindings();
+ try {
+ simpleBindings.containsKey(java.awt.Color.GREEN);
+ }
+ catch (ClassCastException e) {
+ return;
+ }
+ throw new Exception("ClassCastException did not thrown as expected");
+ }
+
+ /**
+ * Test for method containsKey(String)
+ */
+ protected void testContainsKeyNegative5() throws Exception {
+ SimpleBindings simpleBindings = new SimpleBindings();
+ try {
+ simpleBindings.containsKey(this);
+ }
+ catch (ClassCastException e) {
+ return;
+ }
+ throw new Exception("ClassCastException did not thrown as expected");
+ }
+
+ /**
* Entry point to this test case.
*
* @param args parameters passed from command line
More information about the distro-pkg-dev
mailing list