Mercurial > hg > rhino-tests
changeset 366:946d61915104 draft
Ten new tests added into SimpleBindingsTest.
author | ptisnovs |
---|---|
date | Fri, 23 May 2014 08:16:04 +0200 |
parents | 67c8a396f43f |
children | ac41c65e3bb9 |
files | ChangeLog src/org/RhinoTests/SimpleBindingsTest.java |
diffstat | 2 files changed, 145 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ptisnovs@redhat.com> + + * src/org/RhinoTests/SimpleBindingsTest.java: + Ten new tests added into SimpleBindingsTest. + 2014-05-20 Pavel Tisnovsky <ptisnovs@redhat.com> * src/org/RhinoTests/SimpleScriptContextTest.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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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<String, Object>()); + 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