# HG changeset patch # User ptisnovs # Date 1400825764 -7200 # Node ID 946d619151047ff55893a47254d7dc5a59ea0140 # Parent 67c8a396f43fb976d177f11095d9bfe64aea45b3 Ten new tests added into SimpleBindingsTest. diff -r 67c8a396f43f -r 946d61915104 ChangeLog --- a/ChangeLog Tue May 20 09:12:11 2014 +0200 +++ b/ChangeLog Fri May 23 08:16:04 2014 +0200 @@ -1,3 +1,8 @@ +2014-05-23 Pavel Tisnovsky + + * src/org/RhinoTests/SimpleBindingsTest.java: + Ten new tests added into SimpleBindingsTest. + 2014-05-20 Pavel Tisnovsky * src/org/RhinoTests/SimpleScriptContextTest.java: diff -r 67c8a396f43f -r 946d61915104 src/org/RhinoTests/SimpleBindingsTest.java --- a/src/org/RhinoTests/SimpleBindingsTest.java Tue May 20 09:12:11 2014 +0200 +++ b/src/org/RhinoTests/SimpleBindingsTest.java Fri May 23 08:16:04 2014 +0200 @@ -217,6 +217,146 @@ } /** + * Test for method containsKey(String) + */ + protected void testContainsKeyNegative6() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new HashMap()); + try { + simpleBindings.containsKey(null); + } + catch (NullPointerException e) { + return; + } + throw new Exception("NPE did not thrown as expected"); + } + + /** + * Test for method containsKey(String) + */ + protected void testContainsKeyNegative7() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new HashMap()); + try { + simpleBindings.containsKey(""); + } + catch (IllegalArgumentException e) { + return; + } + throw new Exception("IllegalArgumentException did not thrown as expected"); + } + + /** + * Test for method containsKey(String) + */ + protected void testContainsKeyNegative8() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new HashMap()); + try { + simpleBindings.containsKey(new Integer(42)); + } + catch (ClassCastException e) { + return; + } + throw new Exception("ClassCastException did not thrown as expected"); + } + + /** + * Test for method containsKey(String) + */ + protected void testContainsKeyNegative9() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new HashMap()); + 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 testContainsKeyNegative10() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new HashMap()); + try { + simpleBindings.containsKey(this); + } + catch (ClassCastException e) { + return; + } + throw new Exception("ClassCastException did not thrown as expected"); + } + + /** + * Test for method containsKey(String) + */ + protected void testContainsKeyNegative11() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new TreeMap()); + try { + simpleBindings.containsKey(null); + } + catch (NullPointerException e) { + return; + } + throw new Exception("NPE did not thrown as expected"); + } + + /** + * Test for method containsKey(String) + */ + protected void testContainsKeyNegative12() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new TreeMap()); + try { + simpleBindings.containsKey(""); + } + catch (IllegalArgumentException e) { + return; + } + throw new Exception("IllegalArgumentException did not thrown as expected"); + } + + /** + * Test for method containsKey(String) + */ + protected void testContainsKeyNegative13() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new TreeMap()); + try { + simpleBindings.containsKey(new Integer(42)); + } + catch (ClassCastException e) { + return; + } + throw new Exception("ClassCastException did not thrown as expected"); + } + + /** + * Test for method containsKey(String) + */ + protected void testContainsKeyNegative14() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new TreeMap()); + 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 testContainsKeyNegative15() throws Exception { + SimpleBindings simpleBindings = new SimpleBindings(new TreeMap()); + 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